16.2. Quantifiers and Missing Data

The quantified predicates are used with subquery expressions to compare a single value to those of the subquery, and take the general form <value expression> <comp op> <quantifier> <subquery>. The predicate "<value expression> <comp op> [ANY|SOME] <table expression>" is equivalent to taking each row, s, (assume that they are numbered from 1 to n) of <table expression> and testing "<value expression> <comp op> s" with ORs between the expanded expressions:

((<value expression> <comp op> s1)
OR (<value expression> <comp op> s2)
      ...
OR (<value expression> <comp op> sn))

When you get a single TRUE result, the whole predicate is TRUE.

As long as <table expression> has cardinality greater than zero and one non-

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.