Beginner

29. IN Operator

Learn how the IN operator checks whether a value matches any value in a specified list.

📘 Lesson 29 of 728 ⏱ 8 min 🎯 Beginner

The IN operator is used to check whether a column value matches one of several specified values. It provides a cleaner alternative to writing multiple OR conditions when filtering against a list of known values.

Analysts often need to filter records for several specific categories at the same time. IN makes these conditions shorter, clearer, and easier to maintain.

Suppose you want employees from Finance, HR, or IT. Instead of writing three separate OR conditions, you can use IN with the three department names.

SQL
SELECT
    EmployeeName,
    Department
FROM Employees
WHERE Department IN ('Finance', 'HR', 'IT');

IN is commonly used for department filtering, regional analysis, product categories, customer segments, transaction statuses, and business reporting.

  • IN checks against a list of values.
  • IN can replace multiple OR conditions.
  • IN makes queries easier to read.
  • IN can be used with text values.
  • IN can also be used with numbers and other comparable values.
What is the IN operator used for?

IN checks whether a value matches any value in a specified list.

Why use IN instead of multiple OR conditions?

IN usually makes the query shorter, clearer, and easier to maintain when checking against multiple values.

Have you finished this lesson?

Introduction to SQL – All Lessons