RANK Function (Teradata) | Teradata Vantage - 17.10 - RANK (Teradata) - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/djk1612415574830.ditamap
dita:ditavalPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/wrg1590696035526.ditaval
dita:id
kby1472250656485

Returns the rank (1 … n) of all the rows in the group by the value of sort_expression list, with the same sort_expression values receiving the same rank.

A rank r implies the existence of exactly r -1 rows with sort_expression value preceding it. All rows having the same sort_expression value are assigned the same rank.

For example, if n rows have the same sort_expression values, then they are assigned the same rank, call it rank r. The next distinct value receives 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.

Type

Teradata-specific function.