Multiple values

2 snippets in SQL

SQLSQL

IN Operator

SQL · Filtering
syntax
WHERE column IN (value1, value2, ...)
example
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.

INSERT Multiple Rows

SQL · Data Modification
syntax
INSERT INTO table (col1, col2)
VALUES (val1, val2), (val3, val4), ...;
example
INSERT INTO products (product_name, price, category_id)
VALUES
  ('Wireless Mouse', 29.99, 2),
  ('USB Keyboard', 49.99, 2),
  ('27" Monitor', 349.00, 3);
output
-- 3 rows inserted

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.