17.05 - Example: Select Statement - 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)

Consider the following query:

   SELECT statement_1 
   UNION
   SELECT statement_2 
   EXCEPT 
   SELECT statement_3 
   INTERSECT 
   SELECT statement_4;

The operations are performed in the following order:

  1. Intersect the results of statement_3 and statement_4.
  2. Union the results of statement_1 and statement_2.
  3. Subtract the intersected rows from the union.