The IN operator allows you to specify multiple values in a WHERE clause. It is a concise shorthand for multiple OR conditions and can accept literals or a subquery result set.
OR expressions.
-- Syntax for IN: select specific columns where a column matches any value in the list
SELECT column1, column2, ...
FROM table_name
WHERE column_name IN (value1, value2, ...);
-- Select students who belong to either 'Science' or 'Engineering' departments
SELECT * FROM students
WHERE department IN ('Science', 'Engineering');
-- Select employees with specific IDs
SELECT * FROM employees
WHERE employee_id IN (1001, 1003, 1005);
OR checks.IN (SELECT ...) to compare against a set returned from another query.IN is readable and efficient.IN for filtering against a short list of known values (IDs, categories).NOT IN behaves differently with NULL values — be cautious.IN to find all students who have taken any of the courses 'Math', 'History', or 'Physics'.WHERE id IN (SELECT user_id FROM subscriptions WHERE active=1).