Thomson Reuters interview question

Complex SQL Query