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”:
SELECT * FROM Customers WHERE Country IN (‘Germany’, ‘France’, ‘UK’); |
The following SQL selects all customers that are located outside of “Germany”, “France”, or “UK”:
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:
SELECT * FROM Customers WHERE Country IN (SELECT Country FROM Suppliers); |