Assign rank values with ties.
Section: CTEs and window functions
Rank rows by score
sql
sql
SELECT player_id, score,
DENSE_RANK() OVER (ORDER BY score DESC) AS leaderboard_rank
FROM scores;Explanation
Useful for leaderboards and scoring systems.
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 CTEs and window functions