Help me in solving GSQ64 problem

My issue

Learning course: SQL Intermediate
Problem Link: CodeChef: Practical coding for everyone