17.05 - query_expression Syntax - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

Syntax

{ query_factor |
  query_expression { UNION | MINUS | EXCEPT } [ ALL ]
    { query_factor | ( query_expression ) ordering }
}

Syntax Elements

query_factor
query_expression
UNION
MINUS
EXCEPT
Set operators specifying how the two or more queries or subqueries are to combine and determine what result rows are required to be returned.
ALL
Allows duplicate rows to be returned.
ordering
ORDER BY expr_spec [,...]
expr_spec
expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
expression
An expression used in the ORDER BY clause to determine the sort order of returned rows in the result.
ASC
That the results are to be ordered in ascending sort order.
If the sort field is a character string, the system orders it in ascending order according to the definition of the collation sequence for the current session.
The default order is ASC.
DESC
That the results are to be ordered in descending sort order.
If the sort field is a character string, the system orders it in descending order according to the definition of the collation sequence for the current session.
NULLS FIRST
NULL results are to be listed first.
NULLS LAST
NULL results are to be listed last.