Quantiphi interview question

Sql queries