BlackRock interview question

Sql question using groupby and having?