Pergunta de entrevista da empresa Mastek

SQL query about group by, aggregate functions and having clause