Citi Interview Question

SQL query