medium10 pts · first answer countssqlwindow-functions
RANK and DENSE_RANK with ties
Scores are a=90, b=85, c=90, d=80, e=85. What are RANK() and DENSE_RANK() for d when ordered by score descending?
SELECT name, RANK() OVER (ORDER BY score DESC) AS r, DENSE_RANK() OVER (ORDER BY score DESC) AS dr FROM scores;
Discussion 0
Join free to post in the discussion.
Related questions
- Purpose of a primary keyData Engineer
- Row count of a LEFT JOINData Engineer
- Filtering with = NULLData Engineer
- COUNT(*) vs COUNT(column)Data Engineer
- Filtering groups with HAVINGData Engineer
- Adding a number to NULLData Engineer
- Orders pointing to missing customersData Engineer
- Upserting into a target tableData Engineer