Amazon interview question

Basic SQL queries around joins, grouping and some window functions