Basics · Lesson 8 of 19

Multiple Values with IN

IN checks if a value matches any in a list.

SELECT * FROM employees
WHERE department_id IN (1, 2, 3);

This is cleaner than:

WHERE department_id = 1
OR department_id = 2
OR department_id = 3

Works with text too:

WHERE first_name IN ('John', 'Sarah', 'Mike')

NOT IN finds values NOT in the list.

Check your understanding

Find employees in departments 1 or 3.

Examples run on the employees sample database. Open any of them in the playground to experiment.