Google interview question

Write an SQL query for this particular question ?