top of page
CerebroSQL

MySQL: 

DENSE_RANK

DENSE_RANK() over_clause

Returns the rank of the current row within its partition, without gaps.
Peers are considered ties and receive the same rank. This function
assigns consecutive ranks to peer groups; the result is that groups of
size greater than one do not produce noncontiguous rank numbers. For an
example, see the RANK() function description.

This function should be used with ORDER BY to sort partition rows into
the desired order. Without ORDER BY, all rows are peers.

over_clause is as described in
https://dev.mysql.com/doc/refman/8.0/en/window-functions-usage.html.

URL: https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html

Example

bottom of page