MySQL IN

Last Updated: March 12, 2022

MySQL IN operator can be used to check a given value exists in a list of values

value IN (value1, value2, value3,...)

The value can be a column or expression

List of names of employees whose age is 40,41 or 42

SELECT name FROM employees WHERE age IN (40,41,42)

List of names of employees whose age is not 40,41 or 42

SELECT name FROM employees WHERE age NOT IN (40,41,42)
Test