What is the difference between the RANK() and DENSE_RANK() functions?

 Posted by Manicse on 11/2/2016 | Category: Sql Server Interview questions | Views: 122 | Points: 40
Answer:

The only difference between the RANK() and DENSE_RANK() functions is in cases where there is a equal values or TIE.

Example:
Consider the set {25, 25, 50, 75, 75, 100}.
For such a set, RANK() will return {1, 1, 3, 4, 4, 6} (note that the values 2 and 5 are skipped),
whereas DENSE_RANK() will return {1,1,2,3,3,4}.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response