Relative standing from 0 to 1.
Section: Distribution functions
Leaderboard percent rank
sql
sql
SELECT player_id,
score,
PERCENT_RANK() OVER (ORDER BY score) AS pct_rank
FROM leaderboard;Explanation
A convenient way to label records as top 5%, top 10%, and so on.
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 Distribution functions