Allscripts interview question

Sql complex queries