Capgemini Interview Question

SQL query