Affine interview question

joins in Sql, window functions, CTE