In my previous post, I discussed the ROW_NUMBER ranking function which was introduced in SQL Server 2005. In this post, I’ll take a look at the other ranking functions – RANK, DENSE_RANK, and NTILE. Let’s begin with RANK and DENSE_RANK. These functions are similar – both in functionality and implementation – to ROW_NUMBER. The difference…

# Tag: Ranking Functions

## Ranking Functions: ROW_NUMBER

SQL Server 2005 introduced four new functions, ROW_NUMBER, RANK, DENSE_RANK, and NTILE that are collectively referred to as ranking functions. These functions differ from ordinary scalar functions in that the result that they produce for a given row depends on the other rows in the result set. They also differ from aggregate functions in that…