Amazon interview question

SQL questions from Leet code