Dubizzle interview question

CTE, Window Functions in SQL