PERCENT_RANK Function Syntax | Teradata Vantage - PERCENT_RANK Function Syntax - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantage™
PERCENT_RANK() 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.
If there is no PARTITION BY or RESET WHEN clauses, then the entire result set, delivered by the FROM clause, constitutes a partition.
PARTITION BY clause is also called the window partition clause.
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 particular window partitions.
For more information, see “RESET WHEN Condition Rules” and the “QUALIFY Clause” in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146.