What is the difference between row_number and dense_rank?



What is the difference between row_number and dense_rank?..

Answer / Tarkeshwar Prasad

'ROW_NUMBER' assigns a unique number to each row in a result set, regardless of gaps or overlaps. 'DENSE_RANK', on the other hand, assigns sequential numbers without gaps if there are no duplicate values. If duplicates exist, it skips over them. For example: SELECT ROW_NUMBER() OVER (ORDER BY OrderDate) as RowNum,n DENSE_RANK() OVER (ORDER BY OrderDate) as Rank FROM Orders;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What are relationships and mention different types of relationships in the dbms

1 Answers  


Why do we use trigger?

1 Answers  


What are different types of raid levels?

1 Answers  


how many no of arguments can be passed in procedures and functions

2 Answers   ABC,


What are the differences between having and where clause.

1 Answers  


Explain full-text indexing?

1 Answers  


What is logshipping and its purpose?

1 Answers  


Is it ok to shrink transaction log?

1 Answers  


What is the Disadvantage of indexed sequential file.

1 Answers   HCL,


Tell me what are the essential components of sql server service broker?

1 Answers  


do you know what is a deadlock and what is a live lock? How will you go about resolving deadlocks? : Sql server database administration

1 Answers  


What is the difference between cube operator and rollup operator? : SQL Server Architecture

1 Answers  


Categories