Amazon interview question

For the SQL question, it was pretty basic calculation.