Pregunta de entrevista de 1plusX

How would you create an SQL query for this...