Pregunta de entrevista de Cognizant

i got a programming question and a sql joins