SELECT order_id, status
FROM orders
WHERE status IN('pending','processing','shipped');
Output
-- Orders with any of the three listed statuses
Note IN is shorthand for multiple OR conditions. If the list contains a NULL, it will not match NULL rows - use IS NULL separately. You can also use a subquery inside IN.
Note Multi-row INSERT is much faster than individual INSERTs because it reduces round trips and allows batch optimization. Most databases support this syntax. There may be a limit on the number of rows per statement.
Frequently asked questions
How does SQL handle multiple values?
SQL covers this with 2 copy-ready snippets on this page. The "IN Operator" snippet in SQL uses `WHERE column IN (value1, value2, ...)`.
Which statement does the SQL example use?
The "IN Operator" snippet uses `WHERE column IN (value1, value2, ...)`, from the Filtering section of the SQL cheat sheet.
What other SQL snippets are shown for "multiple values"?
Besides "IN Operator", this page also shows "INSERT Multiple Rows".
Is there anything to watch out for?
Yes. For "IN Operator": IN is shorthand for multiple OR conditions. If the list contains a NULL, it will not match NULL rows - use IS NULL separately. You can also use a subquery inside IN.