Protium interview question

sql query on joins and window functions and subqueries