Coding task · SQL and MySQL course · Module 10: Transactions and advanced SQL
Ranking within categories
The Keeper wants a ranking of books by price separately within each category. Use PARTITION BY in the window function.
Task
Write a query that retrieves tytul, kategoria_id and cena from the ksiazki table, and additionally adds a column aliased as miejsce containing the result of ROW_NUMBER() OVER (PARTITION BY kategoria_id ORDER BY cena DESC).