Infosys interview question

4.) SQL query (related to group by and having)