IN vs ANY vs ALL
Compare against sets of values.
What Are IN, ANY, and ALL?
When writing SQL queries, you often need to compare a value against a set of values. SQL gives you three powerful operators for this: IN, ANY, and ALL.
All three can work with subqueries that return a list of values. They look similar but behave differently — choosing the right one can make your query much more expressive and efficient.
The IN Operator
The IN operator checks whether a value matches any value in a list or subquery result. It is the simplest of the three.
The example below retrieves employees who work in the Sales, HR, or Engineering departments.
SELECT name, department
FROM employees
WHERE department IN ('Sales', 'HR', 'Engineering');