ROW_NUMBER, RANK, DENSE_RANK

ROW_NUMBER, RANK and DENSE_RANK number the rows of a window according to an ORDER BY. ROW_NUMBER gives a unique number, RANK assigns the same rank to ties and then skips numbers, DENSE_RANK does not skip numbers. The choice depends on how you want ties handled.

Example

RANK() OVER (ORDER BY ca DESC)

Related concepts

The whole glossary