WareIQ Interview Question

A SQL problem to do