RBC interview question

SQL queries - simple easy LC