Pregunta de entrevista de Wise

How to structure a complex SQL query (technical test)