Part 72: Subqueries in WHERE: IN, ANY, SOME & ALL
Testing conditions against dynamic subquery lists.
1. The IN Subquery
SELECT name FROM customers
WHERE id IN (
SELECT customer_id FROM orders WHERE total_amount > 500
);
2. The ALL and ANY Operators
-- Salary greater than ALL salaries in Marketing:
SELECT first_name, salary FROM employees
WHERE salary > ALL (
SELECT salary FROM employees WHERE department = 'Marketing'
);
Key Takeaways
> ALLmeans greater than the maximum value in the subquery.> ANYmeans greater than at least one value (the minimum).
In Part 73, we explore Correlated Subqueries: Row-by-Row Evaluation Mechanics!

