Considerations for Using Set Operators - Teradata

The following considerations are guidelines for writing each SELECT when using SET operators:

  1. Must specify the same number of columns in the list. Each column must be of the same domain (data type and value range)
  2. If using aggregation, each SELECT must have an individual GROUP BY
  3. Must have a FROM
  4. First SELECT
    • Used to specify FORMAT
    • Used to specify TITLE
    • Used to specify alias names
  5. Last SELECT
    • Used to specify ORDER BY, only one shared by all sets
    • Contains the single semi-colon which ends the statement
  6. When using combined Operators
    • All INTERSECT operators performed first
    • All UNION operators performed second
    • All EXCEPT and MINUS operators performed last
    • Parentheses can be used to change the above order of evaluation
  7. Duplicate rows
    • Eliminated from the answer sets
    • ALL specification can be added to SET operator to return duplicate rows
  8. Can be used in most SQL operations
  9. WITH and WITH BY not supported, treated as data, not a report

The following tables are used in the examples of SET operators:

examples of SET operators

examples of SET operators

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Teradata Topics