Agmo Studio interview question

how to solve/create SQL statement