Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

IN

IN

The IN command permits specifying multiple values within a WHERE clause, functioning as a shorthand for multiple OR conditions.

The subsequent SQL selects all customers situated in “Germany”, “France”, and “UK”:

Example

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

The following SQL selects all customers that are located outside of “Germany”, “France”, or “UK”:

Example

SELECT * FROM Customers
WHERE Country NOT IN (‘Germany’, ‘France’, ‘UK’);

The following SQL selects all customers that are from the same countries as the suppliers:

Example

SELECT * FROM Customers
WHERE Country IN (SELECT Country FROM Suppliers);