FARFETCH Interview Question

Query using Window functions in SQL