SQL 2023 · Aggregation and window functions

Rank rows

Rank products by price, giving ties the same rank.

SELECT name, price, RANK() OVER (ORDER BY price DESC) AS price_rank FROM products;

Official SQL 2023 documentation

More aggregation and window functions commands

All aggregation and window functions commands · SQL 2023 cheatsheet

Was this page helpful?