Pergunta de entrevista da empresa Sigmoid

SQL query based problem mostly