/    /  MySQL – ANY




MySQL’s ANY keyword returns TRUE if any of the conditions of a subquery are satisfied. By using this keyword, you can determine whether any of the subquery conditions have been met when executing the SQL query. There must be an ANY keyword following the comparison operator. All SQL operators work similarly to ANY operators, but they return true when all subquery values satisfy the condition in MySQL.

The ANY operator compares the value of a table to each value provided by the subquery condition. It then returns TRUE if any value in the subquery matches at least one value in the subquery.


SELECT column_name(s)
FROM table_name
WHERE column_name operator ANY
  (SELECT column_name
  FROM table_name
  WHERE condition);


SELECT first_name 
FROM employees
WHERE emp_no = ANY (SELECT dept_no FROM departments WHERE emp_no  = 1);