Thursday, November 12, 2009

Oracle: Difference between Rank and Dense_Rank

RANK leaves gaps while ranking the records whereas DENSE_RANK doesn't leave any gaps. For eg, if we have a tie at the 4th position and there are 2 records with the same value then

RANK - will place both the records in the 4th position, and will have the next record at the 6th position (leaving a gap of 1 position)

DENSE_RANK - will also place both the records in the 4th position, but the next record will be placed at 5th position (no gap will be placed).

2 comments:

  1. Good info, looking forward to more of these :D

    Hope not just another KS of the day :D

    ReplyDelete
  2. Excellent explaination dude!!!

    ReplyDelete