Pregunta de entrevista de Google

Write an SQL query for this particular question ?