SQL Keyword - ANY

ANY Keyword

The ANY keyword or command is used to check logical conditions.

The ANY Keyword is logical operator that compares a single value with a single-column set of values returned by a subquery.

The ANY command returns boolean value True Or False.

Return True if any of the subquery value match the condition.

Syntax

SELECT <COLUMN_NAMES> FROM <TABLE> WHERE <COLUMN_NAME> = ANY (SUBQUERY);

Example

SELECT Emp_ID,Emp_Name, Emp_Salary, Emp_Dept
FROM Employee WHERE Dept_ID = ANY (SELECT Dept_ID FROM Department WHERE Dept_Name = 'Accounts');

Summary

ANY Keyword returns TRUE, if any of the mentioned sub-queries values meet the conditions.