Cvent interview question

Writing a complex SQL query