Amazon Interview Question

Simple sql queries