SQL IN Keyword


IN

The IN command allows you to specify multiple values in a WHERE clause.

The IN operator is a shorthand for multiple OR conditions.

The following SQL selects all customers that are located in "Germany", "France" and "UK":

Example

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

The following SQL selects all customers that are NOT located in "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);


Login
ADS CODE