ROW_NUMBER Function Syntax | VantageCloud Lake - ROW_NUMBER Function Syntax - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
ROW_NUMBER() OVER (
  [ PARTITION BY column_reference [,...] ] 
  ORDER BY value_spec [,...]
  [ RESET WHEN condition ]
)

Syntax Elements

OVER
Specifies how values are grouped, ordered, and considered when computing the cumulative, group, or moving function.
Values are grouped according to the PARTITION BY BEGIN and RESET WHEN clauses END, sorted according to the ORDER BY clause, and considered according to the aggregation group within the partition.
PARTITION BY column_reference [,...]
The group or groups over which the function operates.
ORDER BY
The order in which the values in a group or partition are sorted.
value_spec
value_expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
RESET WHEN
The group, or groups, over which the function operates, depending on the evaluation of the specified condition. If the condition evaluates to TRUE, a new dynamic partition is created inside the specified window partition.
If there is no PARTITION BY or RESET WHEN clauses, then the entire result set, delivered by the FROM clause, constitutes a partition.
condition
A conditional expression used to determine conditional partitioning. The condition in the RESET WHEN clause is equivalent in scope to the condition in a QUALIFY clause with the additional constraint that nested ordered analytical functions cannot specify a RESET WHEN clause. In addition, you cannot specify SELECT as a nested subquery within the condition.
The condition is applied to the rows in all designated window partitions to create sub-partitions within the window partitions.
For more information, see RESET WHEN Condition Rules and QUALIFY Clause.
ASC
Ascending sort order.
DESC
Descending sort order.
NULLS FIRST
NULL results are to be listed first.
NULLS LAST
NULL results are to be listed last.