DRW interview question

SQL Questions about joins and looping and window functions.