Introduction
Ranking functions
Selecting n-th row
Revision

Instruction

Perfect!

As we said, RANK() will always leave gaps in numbering when more than 1 row share the same value. You can change that behavior by using another function: DENSE_RANK():

SELECT
  name,
  platform,
  editor_rating,
  DENSE_RANK() OVER(ORDER BY editor_rating)
FROM game;

DENSE_RANK gives a 'dense' rank indeed, i.e. there are no gaps in numbering.

Exercise

Press Run and check code to run the modified example.

We've now got three rows with rank 1, followed by a fourth row with rank 2. That's the difference between RANK() and DENSE_RANK() – the latter never leaves gaps.

Console

Code editor

Result

TableConsole