In SQL, Any operator is used to return values that match with any value in a single column set of values. It’s like an OR operator, and it will compare a value against any value in the defined column.
To check any operator in SQL with examples, execute the following script to create a new table in the SQL database.
Once we execute the above script, the new table’s example1 and example2 will create and return the following result.
Our tables are ready to check how ANY operator will work in SQL with examples, then execute the following queries.
Following is the example of using any operator in SQL.
When we execute the above SQL query, we will get a SQL any operator result like shown below.
In the above query, the “id” column in the example1 table will compare with all id's in the example2 table.
Following is another example of using any operator in SQL.
When we execute the above query, we will get the result below.