Invesco Interview Question

They gave one sql query based on group by ,order by and having clause.