This Oracle tutorial explains how to use the Oracle/PLSQL CUME_DIST function with syntax and examples.
The Oracle/PLSQL CUME_DIST function returns the cumulative distribution of a value in a group of values. The CUME_DIST function will return a value that is >0 and <=1.
The CUME_DIST function can be used two ways - as an Aggregate function or as an Analytic function.
As an Aggregate function, the CUME_DIST function returns the relative position of a row within a group of rows.
The syntax for the CUME_DIST function when used as an Aggregate function is:
expression1 .. expression_n can be one or more expressions which identify a unique row in the group.
The CUME_DIST function returns a numeric value.
The CUME_DIST function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle CUME_DIST function examples and explore how to use the CUME_DIST function in Oracle/PLSQL.
For example:
The SQL statement above would return the cumulative distribution of an employee with a salary of $1,000 and a bonus of $500 from within the employees table.
As an Analytic function, the CUME_DIST function returns the relative position of a value within a group of values.
The syntax for the CUME_DIST function when used as an Analytic function is:
The CUME_DIST function returns a numeric value.
The CUME_DIST function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle CUME_DIST function examples and explore how to use the CUME_DIST function in Oracle/PLSQL.
For example:
The SQL statement above would return the salary percentile for each employee in the Marketing department.