IN — Match from a List
The IN keyword allows you to check if a value exists in a list of values.
It’s a clean and readable way to match against multiple values without chaining lots of OR conditions.
Syntax
SELECT column1, column2, ... FROM table_name
WHERE column IN (value1, value2, ...);
Example 1: Employees in HR or Finance
SELECT name, department FROM employees
WHERE department IN ('HR', 'Finance');
This returns all employees who are in either the HR or Finance department.
Example 2: Employees aged 25, 28, or 30
SELECT name, age FROM employees
WHERE age IN (25, 28, 30);
This returns employees whose age is 25, 28, or 30.
Tip
You can also combine IN with NOT to exclude values:
SELECT name FROM employees
WHERE department NOT IN ('IT', 'Sales');
The IN clause helps you write cleaner, more readable filters when matching multiple values.