PostgreSQLWindow FunctionsCUME_DIST
PERCENT_RANK

CUME_DISTWindow Functions

NTILE

Returns the cumulative distribution value.

Syntax

CUME_DIST() OVER (w)

Example

Enter values below to update the example in real time.

employee_id
salary
employees
SELECT employee_id, salary,
       ROUND(CUME_DIST() OVER (ORDER BY salary)::numeric, 4) AS cume_dist
FROM employees;