O'Reilly logo

Tera-Tom's 1000 Page e-Book on Teradata Architecture and SQL, 2nd Edition by Tom Coffing, William Coffing

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required