expr IN (value,...) : IN « Comparison Functions Operators « MySQL Tutorial






Returns 1 if expr is equal to any of the values in the IN list, else returns 0.

If all values are constants, they are evaluated according to the type of expr and sorted.

IN returns NULL if the expression on the left hand side is NULL.

IN returns NULL if no match is found in the list and one of the expressions in the list is NULL.

expr NOT IN (value,...) is the same as NOT (expr IN (value,...)).

mysql>
mysql> SELECT 2 IN (0,3,5,7);
+----------------+
| 2 IN (0,3,5,7) |
+----------------+
|              0 |
+----------------+
1 row in set (0.01 sec)








15.7.IN
15.7.1.expr IN (value,...)
15.7.2.SELECT 'A' IN ('A','B','C');
15.7.3.You should never mix quoted and unquoted values in an IN list
15.7.4.Use IN with data in a table
15.7.5.Using IN with subquery
15.7.6.Using more than one column with a NOT IN operator