query_expression Syntax - 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™

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.