SQL ANY ALL Operator
SQL ANY and ALL Operators are used with a WHERE or HAVING Clause.
ANY Operator Syntax
SELECT column_name(s)
FROM table_name
WHERE column-name operator ANY (
SELECT column_name
FROM table_name
WHERE [condition]);
ALL Operator Syntax
SELECT column_name(s)
FROM table_name
WHERE column-name operator ALL (
SELECT column_name
FROM table_name
WHERE [condition]);
ANY ALL Operator Conditions
- ALL Operator returns true if all of the subquery values meet the condition.
- ANY keywords returns true if any of the subquery values meet the condition.
- ANY and ALL operate on subqueries that return multiple values.
- The ANY operator is a logical operator that compares a scalar value with a single-column set of values returned by a subquery.