Agmo Studio Interview Question

how to solve/create SQL statement