Moody's interview question

SQL table analytics