23

Quantified Subquery Predicates

A quantifier is a logical operator that states the quantity of objects for which a statement is TRUE. This is a logical quantity, not a numeric measurement or count; it relates a statement to the whole set of possible objects. In everyday life, you see statements like, “There is only one mouthwash that stops dinosaur breath,” “All doctors drive Mercedes,” “Some people got rich investing in cattle futures,” or “Nobody eats Grandmother’s fruitcake,” which are quantified.

The first statement, about the mouthwash, is a uniqueness quantifier. If there were two or more products that could save us from dinosaur breath, it would be FALSE. The second statement has what is called a universal quantifier, since it deals ...

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.