CUME_DIST()
CUME_DIST() is a SQL function in the Window Functions category. Cumulative distribution: proportion of rows with values <= current row's value. The syntax is CUME_DIST() OVER (ORDER BY column). It accepts ORDER BY column. It returns cumulative distribution (0 to 1). A typical example: SELECT name, salary, CUME_DIST() OVER (ORDER BY salary DESC) AS cum_dist FROM employees; -- e.g., value 0.25 means 25% of employees have salary <= this A close relative is ROW_NUMBER(), which assigns a unique sequential integer to each row within its partition (1, 2, 3...). A close relative is RANK(), which similar to ROW_NUMBER but gives the same rank to equal values. Leaves gaps in ranking. A close relative is DENSE_RANK(), which like RANK but without gaps. Equal values get the same rank, and the next number follows sequentially. More about this category: Window/analytical functions — ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, NTILE.