27.3. The CONTAINS Operators

Set theory has two symbols for subsets. One, ⊂, means that set A is contained within set B; this is sometimes said to denote a proper subset. The other, ⊆ means “is contained in or equal to,” and is sometimes called just a subset or containment operator.

Standard SQL has never had an operator to compare tables against each other for equality or containment. Several college textbooks on relational databases mention a CONTAINS predicate, which does not exist in Standard SQL. This predicate existed in the original System R, IBM’s first experimental SQL system, but it was dropped from later SQL implementations because of the expense of running it.

27.3.1. Proper Subset Operators

The IN predicate is a test for membership. ...

Get Joe Celko's SQL for Smarties, 3rd 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.