Rank categories by revenue without gaps.
Section: window functions
Dense rank grouped totals
sql
sql
SELECT
category,
revenue,
DENSE_RANK() OVER (ORDER BY revenue DESC) AS revenue_rank
FROM category_revenue;Explanation
Unlike `RANK`, `DENSE_RANK` does not skip numbers after ties.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing window functions