The quantified comparison predicate compares the specified value (
x
) with the values returned by a subquery. If ALL is specified, then the value is tested for its appearance in all records returned by the subquery. If either ANY or SOME is specified (these two keywords are equivalent), the value is tested for its appearance in at least one of the records returned by the subquery. If no keyword is supplied, the subquery is interpreted as a
scalar
subquery, which must return exactly one row and one value.
If the value
x
is null, or the subquery returns no rows, the predicate will evaluate to UNKNOWN. The SELECT statement (subquery) may only return values from a single column, or in the case of a scalar subquery, only a single value.