IN is a shorthand for several OR conditions:
WHERE Country IN ('UAE', 'UK', 'Canada')
NOT IN excludes the values. IN also accepts a subquery: WHERE CustomerID IN (SELECT CustomerID FROM Orders).
Match any value in a list.
✍️ 3 exercises + code challenge in this lessonIN is a shorthand for several OR conditions:
WHERE Country IN ('UAE', 'UK', 'Canada')
NOT IN excludes the values. IN also accepts a subquery: WHERE CustomerID IN (SELECT CustomerID FROM Orders).
Mastering SQL IN helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
SELECT CustomerName, Country FROM Customers
WHERE Country IN ('UAE', 'UK', 'Canada');
-- Customers who have placed at least one order
SELECT CustomerName FROM Customers
WHERE CustomerID IN (SELECT CustomerID FROM Orders);
Check what you learned in “SQL IN”.
Match any of several cities.
WHERE City ('Lahore', 'Karachi')
IN is a shorthand for multiple…
Select CustomerName of customers in 'UK' or 'Canada'.
Free sign-in required · Google login available
Stuck on something?
Ask the community in the CodesInTech forum.
Need a developer?
Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.
Explore Our Services