Amazon Interview Question

SQL queries