This function calculates the cumulative distribution of a value in a group of values. This is computed for each row as follows:
- NP is the number of rows with order value less than or equal to the current row
- NR is the total number of rows in the group
- CUME_DIST is only available as an analytic function (i.e., in combination with an over_clause). For more information, refer to Analytic Functions section.
- This function returns values in the range (0, 1].
- CUME_DIST does not allow the use of a window_frame_clause. It uses the entire partition as window for the computation of the result.
id, department, current_salary,
CUME_DIST() OVER (PARTITION BY department ORDER BY current_salary) CUME_DIST
FROM employee_table ORDER BY department, current_salary;