row_number() vs rank() and dense_rank() analytical functions
Hi,
What's the difference between the row_number(), rank() and dense_rank() analytical functions?
The way I understand it (for example dataset: A, B, B, C, C, D, E, F)
* row_number() always yields ascending numbers for each row (1, 2, 3, 4, 5, 6, 7, 8)
* rank() numbers equivalent rows with the same number and then skips to the next number (1, 2, 2, 4, 4, 6, 7, 8)
* dense_rank() is like rank but doesn't skip (1, 2, 2, 3, 3, 4, 5, 6)
And there's no difference between the three if you never have 'duplicate rows'.
Am I correct here?
Thanks,
Colin