Coding task · SQL and MySQL course · Module 10: Transactions and advanced SQL

Ranking books with RANK

The Keeper wants to give the books ranks by price - from the most expensive. Use the RANK() window function.

Task

Write a query that retrieves tytul and cena from the ksiazki table, and additionally adds a column aliased as ranga containing the result of RANK() OVER (ORDER BY cena DESC). Use the word AS to name the ranga column.