PL/SQL What is the difference between rank and dense_rank functions

What is the difference between rank and dense_rank functions

The Rank function allow you to rank items in a group, while the Dense_Rank function make the same but Dense_Rank leaves no gaps in ranking sequence when there are ties.

Example

Select rank(1200, 500) WITHIN GROUP (ORDER BY e.sal, e.comm) From emp e;

Select dense_rank(1200, 500) WITHIN GROUP (ORDER BY e.sal, e.comm) From emp e;

Syntax:

– Rank function

– Dense_Rank function