Window Functions
Percent Rank and Cumulative Distribution
Senior Data Analyst
March 8, 2026
5 min read
The Statistical View
Data science needed a more nuanced ranking: not just 1st, 2nd, 3rd, but a percentage showing relative standing.
The Functions
SELECT
name, score,
PERCENT_RANK() OVER (ORDER BY score) AS pct_rank,
CUME_DIST() OVER (ORDER BY score) AS cume_dist
FROM test_scores;
Pro Tip
These are the SQL equivalents of statistical percentile functions. Great for identifying outliers or benchmarking performance.
*Day 68: Filtering Window Function Results.*