CUME_DIST
Examples
select
id,
salary,
cume_dist() over (order by salary)
from employee
order by salary;
id salary cume_dist -- ------ --------- 3 8.00 0.2 4 9.00 0.4 1 10.00 0.8 5 10.00 0.8 2 12.00 1
CUME_DIST
Examplesselect
id,
salary,
cume_dist() over (order by salary)
from employee
order by salary;
id salary cume_dist -- ------ --------- 3 8.00 0.2 4 9.00 0.4 1 10.00 0.8 5 10.00 0.8 2 12.00 1
DENSE_RANK()
Rank of rows in a partition without gaps
BIGINT
DENSE_RANK () OVER <window_name_or_spec>
Rows with the same window_order values get the same rank within the partition window_partition, if specified.The dense rank of a row is equal to the number of different rank values in the partition preceding the current row, plus one.
DENSE_RANK
Examplesselect
id,
salary,
dense_rank() over (order by salary)
from employee
order by salary;
id salary dense_rank -- ------ ---------- 3 8.00 1 4 9.00 2 1 10.00 3 5 10.00 3 2 12.00 4
NTILE()
Distributes the rows of the current window partition into the specified number of tiles (groups)
BIGINT
NTILE ( number_of_tiles ) OVER <window_name_or_spec>
Argument | Description |
---|---|
number_of_tiles |
Number of tiles (groups).Restricted to a positive integer literal, a named parameter (PSQL), or a positional parameter (DSQL). |