X Interview Question

SQL query