Measure relative row position inside an ordered set.
Section: Buckets and Percentiles
Use PERCENT_RANK and CUME_DIST
sql
sql
SELECT employee_id, salary,
PERCENT_RANK() OVER (ORDER BY salary) AS percent_rank,
CUME_DIST() OVER (ORDER BY salary) AS cumulative_distribution
FROM employees;Explanation
Useful for reporting on distribution and percentile-like placement.
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 Buckets and Percentiles