ANY Operator
The ANY operator in SQL Server compares a column value or literal value with a single-column set of values returned by subquery. The data type of the single column in the subquery should be the same as the data type of the scalar expression column value.
Syntax:
[scalar_expression] [comparison_operator] ANY (subquery)
- scalar_expression: This refers to any valid expression
- comparison_operator: This refers to any one of the standard comparison operators.
- ANY: Operator must be preceded by any one of the comparison operators like =, !=, >, >=, <, or <=
- subquery: Refers here to a ‘Select’ statement that returns a single column of values.
SQL Server ANY Operator
In SQL Server there are many different types of Logical operators like ANY, AND, LIKE, EXISTS, NOT, IN, and BETWEEN. The logical operators are used to perform conditional checks in SQL Queries. These operators are very useful to filter and compare single or multiple data in SQL Queries. In this article let us discuss the ‘ANY’ operator available in SQL Server.