Amazon Interview Question

It was mostly based on sql, logical thinking.