Wise interview question

How to structure a complex SQL query (technical test)