Column References and ORDER BY - Advanced SQL Engine - Teradata Database

SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
qtb1554762060450.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™

Each column_name you specify in an ORDER BY clause must be the name of a column in a relation referenced in the SELECT expression list. The columns named do not have to match the columns in the SELECT expression list.

You can also order on a column_name_alias.

You can specify up to 64 column names.

You cannot specify BLOB or CLOB columns in the column name list because you cannot sort on LOB values.

The column position you specify in an ORDER BY clause must be an unsigned integer that refers to the sequential position of a column in the SELECT expression list. The column position cannot be passed as a parameter, because the parameter is interpreted as an expression and the data is sorted by a constant. You cannot specify BLOB or CLOB columns in the column position list because you cannot sort on LOB values.

For ORDER BY references to UDT columns, the database uses the defined ordering functionality for that UDT to order the result set.

You can specify a scalar subquery as a column expression in the ORDER BY clause of a query.