When subqueries are used with quantifiers and comparison operations or IN/NOT IN predicates, the results are determined as follows.
Quantifier | Predicate | Result | Condition |
---|---|---|---|
ALL | Comparison operation | TRUE | One of the following:
|
IN | TRUE | One of the following:
|
|
NOT IN | TRUE | One of the following:
|
|
|
Comparison operation | TRUE | the comparison of expression and at least one value in the set of values returned by subquery is true. |
IN | expression is equal to at least one value in the set of values returned by subquery. | ||
NOT IN | expression is not equal to at least one value in the set of values returned by subquery. | ||
Comparison operation | FALSE | subquery returns no values. | |
IN | |||
NOT IN |