Chapter 33 - Set Operators Functions

“Good advice is something a man gives when he is too old to set a bad example”

- Francois de la Rouchefoucauld

Rules of Set Operators

1.     Each querywill have two SELECT Statements separated by a SET Operator

2.     SET Operators are UNION, INTERSECT, or EXCEPT/MINUS

3.     Must specify the same number of columns from the same domain (data type/range)

4.     If using Aggregates, both SELECTs much have their own GROUP BY

5.     Both SELECTS must have a FROM Clause

6.     The First SELECT is used for all ALIAS, TITLE, and FORMAT Statements

7.     The Second SELECT will have the ORDER BY statement, which must be a number

8.     When multiple operators the order of precedence is INTERSECT, UNION, and EXCEPT/MINUS ...

Get Tera-Tom's 1000 Page e-Book on Teradata Architecture and SQL, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.