RANK
Translation specification for the transformation of the RANK() function
Description
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. (RANK in Teradata)
Teradata syntax
RANK ( sort_expression [ ASC | DESC ] [,...] )Snowflake syntax
RANK() OVER
(
[ PARTITION BY <expr1> ]
ORDER BY <expr2> [ { ASC | DESC } ]
[ <window_frame> ]
)Sample Source Pattern
Setup data
Teradata
Snowflake
RANK() using ASC, DESC, and DEFAULT order
Teradata
Notice that Teradata's ordering default value when calling RANK() is DESC. However, the default in Snowflake is ASC. Thus, DESC is added in the conversion of RANK() when no order is specified.
SALES
SALESASC
SALESDESC
SALESDEFAULT
NULL
6
6
6
200
5
1
1
150
3
2
2
150
3
2
2
120
2
4
4
100
1
5
5
Snowflake
SALES
SALESASC
SALESDESC
SALESDEFAULT
NULL
6
6
6
200
5
1
1
150
3
2
2
150
3
2
2
120
2
4
4
100
1
5
5
Last updated
Was this helpful?