DENSE_RANK

DENSE_RANK returns the rank of a value in a group of values. It is similar to RANK, except that there are no gaps in the order from equivalent ranks as there are in RANK.

No Parameters

Returns: integer

Example

query:

SELECT playerid, HR, DENSE_RANK() OVER ( ORDER BY HR DESC)
  FROM batting
 WHERE yearId = 2000
 ORDER BY HR DESC, playerid

result:

playerid HR dense_rank
sosasa01 50 1
bondsba01 49 2
bagweje01 47 3
glaustr01 47 3
guerrvl01 44 4
hidalri01 44 4
giambja01 43 5
sheffga01 43 5
thomafr04 43 5
edmonji01 42 6
heltoto01 42 6
batisto01 41 7