CHAPTER 2
Discovering Ranking Functions
The four ranking functions were introduced to T-SQL by Microsoft in 2005. Three of the functions, ROW_NUMBER, RANK, and DENSE_RANK, assign a sequential number to each row in a query’s results. The fourth ranking function, NTILE, divides the rows by assigning a bucket number to the each row in the results. The group of low ranking rows gets an NTILE value of one while the highest ranking group of rows is assigned the top number.
While adding a number to a row is not generally the answer in itself, this functionality is often the basis for many solutions. This chapter shows how to use the four ranking functions ...
Get Expert T-SQL Window Functions in SQL Server now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.