bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL IN Keyword

In

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 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);

Previous

SQL HAVING Keyword

Next

SQL INDEX Keyword