Difference between IN and ANY operators in SQL

Jagan picture Jagan · Sep 13, 2010 · Viewed 58.9k times · Source

What is the difference between IN and ANY operators in SQL?

Answer

Pranay Rana picture Pranay Rana · Sep 13, 2010
SQL>
SQL> -- Use the ANY operator in a WHERE clause to compare a value with any of the values in a list.
SQL>

SQL> -- You must place an =, <>, <, >, <=, or >= operator before ANY.

SQL> SELECT *
  2  FROM employee
  3  WHERE salary > ANY (2000, 3000, 4000);

For In Operator

SQL> -- Use the IN operator in a WHERE clause to compare a value with any of the values in a list.
SQL> SELECT *
  2  FROM employee
  3  WHERE salary IN (2000, 3000, 4000);

But with the IN operator you cannot use =, <>, <, >, <=, or >=