column values vs dense rank vs rank vs row number

suggest change

here you can find the functions.

With the table wf_example created in previous example, run:

select i
  , dense_rank() over (order by i)
  , row_number() over ()
  , rank() over (order by i)
from wf_example

The result is:

i | dense_rank | row_number | rank
---+------------+------------+------
1 |          1 |          1 |    1
1 |          1 |          2 |    1
1 |          1 |          3 |    1
2 |          2 |          4 |    4
2 |          2 |          5 |    4
3 |          3 |          6 |    6
4 |          4 |          7 |    7
5 |          5 |          8 |    8

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents