Home » Interview Q & A » Q13. What is the basic difference between ROW_NUMBER, RANK and DENSE_RANK functions?

Q13. What is the basic difference between ROW_NUMBER, RANK and DENSE_RANK functions?

Our Categories

Blog Stats

  • 32,852 hits

Calendar

June 2013
M T W T F S S
« May    
 12
3456789
10111213141516
17181920212223
24252627282930

Please visit SQLVERSITY.COM for more details.

ROW_NUMBER: It just returns the sequence numbers starts from 1.

RANK: Returns the rank of each record in the current result set.

DENSE_RANK: It is same as Rank() function. But it returns without gaps in ranking.

Do not worry about these definitions 🙂 Please look at the below data and respective ranks. You will be able to understand the actual difference between them.

Ranking Functions

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: