WareIQ interview question

A SQL problem to do