Amazon Interview Question

SQL query - test - with joins and complex logics.