SQL Server – Ranking Functions – RANK, DENSE_RANK, ROW_NUMBER, NTILE

Ranking functions return a ranking value for each row in a partition. Depending on the function that is used, some rows might receive the same value as other rows. Ranking functions are nondeterministic. There are four functions RANK DENSE_RANK ROW_NUMBER NTILE RANK   Returns the rank of each row within the partition of a result set. The rank of a row is one plus the number of ranks that come before the row in question. DENSE_RANK Returns the rank of

» Read more