PostgreSQLWindow FunctionsPERCENT_RANK
DENSE_RANK

PERCENT_RANKWindow Functions

CUME_DIST

Returns the relative rank as a value between 0 and 1.

Syntax

PERCENT_RANK() OVER (w)

Example

Enter values below to update the example in real time.

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