In this article
Ranking functions calculate ranks of values within a series of values according to the specified sorting criteria.
All ranking functions accept the same set of arguments:
Func(sorting[, partition1, partition2,…])
Sorting argument is a ordering criteria definition. All records in the input data set are sorted according to these criteria and assigned ranks according to the resulting order.
As a special case a simple expression may be specified as a "sorting" argument, in that case the function assumes ascending sorting by the specified expression value.
Optional partition arguments are expressions defining groups. If partition expressions are specified then ranks are evaluated independently in every group of records with the same combination of values of those expressions.
| Function | Description |
| Rank(sorting[, partition1, partition2…]) | Rank function evaluates a sequence of numbers according to the specified criteria from lower to upper. Records that are considered "equal" according to the criteria will get the same rank value. The rank sequence can contain gaps. |
| RankRev(sorting[, partition1, partition2…]) | Similar to Rank function with sorting criteria reversed (thus ranking is from higher to lower values). |
| DenseRank(sorting[, partition1, partition2 …]) | Evaluates a dense record rank according to the specified list of sorting criterion. In contrast with the Rank function the sequence produced by DenseRank function cannot contain gaps. |
| DenseRankRev(sorting[, partition1, partition2 …]) | Similar to DenseRank function with sorting order reversed. |