SQL IN Operator (original) (raw)

Last Updated : 16 Apr, 2026

The IN operator in SQL is used to filter query results by checking whether a column’s value matches any value in a specified list. It acts like a shorthand for writing multiple OR conditions, making queries cleaner and easier to read.

**Syntax:

SELECT column_name
FROM table_name
WHERE column_name IN (value1, value2, .....);

Example of SQL IN Operator

Let's understand IN Operator in SQL with examples. Here we will look at different examples. First, we create a demo SQL database and table, on which we will use the IN Operator command.

emp_table

Example 1: Basic Use of the IN Operator

SQL Query to get Fname and Lname of employees who have address in Tokyo, Japan, France and Paris.

**Query:

SELECT Fname, Lname
FROM Employee
WHERE Address IN ('Tokyo, Japan', 'Paris, France');

**Output:

new_output

Example 2: SQL IN and NOT IN Operators

We can use the SQL IN with the NOT operator to exclude specified data from our result.

**Query:

SELECT Fname
FROM Employee
WHERE Address NOT IN ('Tokyo, Japan', 'London, UK');

**Output:

F-name

Example 3: IN Operator with Subquery

We have used IN operator with explicit values for conditions. However, we can use the IN operator to select values for the condition from another query. For demonstrating this, we will use another table from the database, manager. The contents of the table are given below.

Department

Now, we write a query to fetch details of all employees who are managers. This can be done by using nested SELECT queries with the IN operator.

**Query:

SELECT * FROM employee
WHERE Ssn IN (SELECT Ssn FROM manager);

**Output:

Join

**Note: The IN operator returns TRUE if a value matches any item in the given list or subquery result.