Set Operations
By set operations, I mean union, intersection, and set differences where the sets in SQL are tables. These are the basic operators used in elementary set theory, which has been taught in the US public school systems for decades. Since the relational model is based on sets, you would expect that SQL would have had a good variety of set operators from the start. But this was not the case. Standard SQL has added the basic set operators, but they are still not common in actual products.
There is another problem in SQL that you did not have in high school set theory. SQL tables are multisets (also called bags), which means that, unlike sets, they allow duplicate elements (rows or tuples). Dr. Codd’s relational model is stricter and ...
Get Joe Celko's SQL for Smarties, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.