Returns the rank (1 through n) of the rows in the group by the value of sort_expression list. The same sort_expression values have the same rank.
A rank r implies the existence of exactly r -1 rows with sort_expression value preceding it. Rows with the same sort_expression value have the same rank.
n rows with the same sort_expression values are assigned the same rank, r. The next distinct value gets rank r +n.
Less formally, RANK sorts a result set and identifies the numeric rank of each row in the result. The only argument for RANK is the sort column or columns, and the function returns an integer that represents the rank of each row in the result.
ANSI Compliance
This statement is a Teradata extension to the ANSI SQL:2011 standard.
Type
Teradata-specific function.