Example: Rank and Relative Rank - Teradata Vantage - Analytics Database

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-03-30
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantageā„¢

Determine the rank and the relative rank of Christmas sales.

   SELECT sales_amt,
   RANK() OVER (ORDER BY sales_amt),
   PERCENT_RANK () OVER (ORDER BY sales_amt)
   FROM xsales;
sales_amt Rank Percent_Rank
100.00 1 0.000000
120.00 2 0.125000
130.00 3 0.250000
140.00 4 0.375000
143.00 5 0.500000
147.00 6 0.625000
150.00 7 0.750000
155.00 8 0.875000
160.00 9 1.000000