ANY/SOME
On the right side of the operator is the bracketed subquery, which must return the contents of only one column. We compute the expression on the left side of the operator and then compare each row of the subquery result with the given operator to produce a result of type BOOLEAN. If the return value is true, then the result of ANY operation is "true". If no result is found with a true return value (including the specific case where the subquery returns no rows), then the result is "false".
expression operator ANY (subquery)
expression operator SOME (subquery)
SOME is a synonym for ANY. IN is equivalent to '= ANY'.
Note that if there are no successful returns here, and at least one row of the expression to the right of the operator produces a null value for the result of the operator, then the result of the ANY operator construct will be null, not "false". This is consistent with the general SQL rule for combining null values with Boolean variables.
As with EXISTS, it is not wise to assume that the subquery will complete the query for all rows involved.
Top comments (0)