query_expression Syntax - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

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 the results 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 the results 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.