SQLite IN Operator
The IN Operator
IN lets you list many values in a WHERE clause. It is a short way of writing many OR conditions.
This example selects all the customers from Germany, France or the UK:
NOT IN
With NOT IN, you get the records that are not in the list:
IN With a Subquery
The list can also be the result of another query. This example selects the customers that have placed an order:
Example
SELECT * FROM Customers
WHERE CustomerID IN
(SELECT CustomerID FROM Orders);
Try it Yourself »
And this example selects the customers that have not placed any order:
Example
SELECT * FROM Customers
WHERE CustomerID NOT IN
(SELECT CustomerID FROM Orders);
Try it Yourself »