Skip to main content

INSERT

Add rows to a table.

Syntax

Parameters

ParameterDescription
tableThe target table to insert into
columnOptional list of target columns. When omitted, values must match the table's column order
valueA literal value or expression for a single column
select_statementA SELECT query whose result set is inserted

Examples

Single row

INSERT INTO employees (id, name, department, salary)
VALUES (1, 'Alice Chen', 'engineering', 125000);

Multiple rows

INSERT INTO employees (id, name, department, salary)
VALUES
(2, 'Bob Park', 'marketing', 95000),
(3, 'Carol Wu', 'engineering', 130000),
(4, 'Dave Roy', 'sales', 88000);

Insert from SELECT

INSERT INTO archived_orders (id, customer_id, total, created_at)
SELECT id, customer_id, total, created_at
FROM orders
WHERE created_at < '2024-01-01';

See also