Amazon Interview Question

SQL queries based on rank functions