bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL IN Operator

Concept visual

SQL IN Operator

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

The SQL IN Operator

The IN

operator is used in the WHERE clause to check if a specified column's value matches any value within a provided list.

The IN

operator functions as a shorthand for multiple OR conditions, making queries shorter and more readable.

The following SQL uses the IN

operator to select all customers from Germany, France, or UK:

Example

SELECT * FROM Customers
WHERE Country IN ('Germany', 'France', 'UK');

The following SQL uses multiple

OR conditions to select all customers from Germany, France, or UK (same result, but longer code):

Example

SELECT * FROM Customers
WHERE Country = 'Germany' OR Country = 'France' OR Country = 'UK';

Syntax

Select

column_name(s)

From

table_name

Where

column_name IN (

value1, value2, ...);

Demo Database

Below is a selection from the

Customers table used in the examples:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

Alfreds Futterkiste

Maria Anders

Obere Str. 57

Berlin

12209

Germany

Previous

SQL Wildcards

Next

SQL BETWEEN Operator