EveryMatrix interview question

Asked to write a SQL query.