What are the differences between “row_number()”, “rank()” and “dense_rank()”?



What are the differences between “row_number()”, “rank()” and “dense_r..

Answer / Sandeep Kumar Shukla

Row_number() assigns a unique number to each row in a result set, regardless of any duplicates. Rank() assigns a rank to each distinct value, with ties assigned the same rank and a sequence number added to distinguish them. Dense_rank() is similar to rank(), but it does not have gaps in the sequence numbers when there are ties.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

Tell me about normalization in DBMS.

1 Answers   Honeywell, Zomato,


What the different components of Replication and what is their use?

1 Answers  


What do you mean by data integrity?

1 Answers  


how to take backup bcp out for a column in table in sql server?

1 Answers  


What command do we use to rename a database?

1 Answers  


What is Peer to peer Replication?

1 Answers   CarrizalSoft Technologies, HCL,


How is table type constraint applied to a table?

1 Answers  


How to use the inserted and deleted pseudo tables?

1 Answers  


There is a trigger defined for INSERT operations on a table, in an OLTP system. The trigger is written to instantiate a COM object and pass the newly insterted rows to it for some custom processing. What do you think of this implementation? Can this be implemented better?

1 Answers  


Which are the important points to note when multilanguage data is stored in a table?

1 Answers  


When setting replication, is it possible to have a publisher as 64 bit sql server and distributor or subscribers as a 32 bit sql server?

1 Answers  


What is the diff between Static Queries and Dynamic queries give me some examples

2 Answers   CSC,


Categories