Pregunta de entrevista de Tech Mahindra

Showed SQL query and asked to solve