Saturday, 14 April 2012
SQL SERVER – 2005 – Sample Example of RANKING Functions – ROW_NUMBER, RANK, DENSE_RANK, NTILE
ROW_NUMBER
·
Returns the sequential number of a row within a
partition of a result set, starting at 1 for the first row in each partition.
RANK
·
Returns the rank of each row within the partition of a
result set.
DENSE_RANK
·
Returns the rank of rows within the partition of a
result set, without any gaps in the ranking.
NTILE
·
Distributes the rows in an ordered partition into a
specified number of groups
Following example is excellent example from BOL again. This function
explains usage of all the four function together in one query.
Subscribe to:
Posts (Atom)