RANKING FUNCTION [RANK vs ROW_NUMBER vs DENSE_RANK]

Always forgetting about these useful functions... and even when we do, how to use them to our advantage....(see comments at bottom for example)

Ranking Function

Rank:-assigns A Unique Number For Each Row Starting With 1,except For Rows That Have Duplicate Values,in Which Case The Same Ranking Is Assigned And A Gap Appears In The Sequence For Each Duplicate Ranking.

Row_number:-returns A Unique Number For Each Row Starting With 1.for Rows That Have Duplicate Values,numbers Are Arbitarily Assigned.

Dense_rank:-assigns A Unique Number For Each Row Starting With 1,except For Rows That Have Duplicate Values ,in Which Case Same Ranking Is Assigned.

Pages: 1· 2· 3