Dense_Rank is exact same but it avoid gaps in ranking TIP#39


As discussed in last tip #37 Dense rank having exactly same syntax like Rank the only difference between rank & dense rank is that “dense_Rank fill the gap or avoid gap in ranking means if two row set have same ranking then just after record will have just next ranking.

I am taking same example as we discussed in 27 and using Dense_Rank function.

The syntax is as follow

SELECT  Dense_Rank() OVER (Partition BY column name Order by column name ASC/DESC) , other columns FROM tableName

Now example



I will club all this four in next tip and discuss difference.



Leave a Reply

Your email address will not be published. Required fields are marked *