Pergunta de entrevista da empresa Amazon

For the SQL question, it was pretty basic calculation.