Deloitte Interview Question

SQL query