The INSERT INTO statement adds new rows to a table. It's the "C" in CRUD (Create, Read, Update, Delete) — every piece of data that ends up in a database started life as an INSERT statement, whether it was run by hand, generated by an application's signup form, or loaded in bulk from a file.

Basic Syntax

You can insert a row by listing values for every column in table order, but it's much safer to explicitly name the columns you're providing values for:

-- Works, but fragile — relies on knowing the exact column order
INSERT INTO employees
VALUES (101, 'Maria Chen', 'Engineering', 95000, '2024-03-10');

-- Safer: explicit column list, order doesn't matter here
INSERT INTO employees (id, name, department, salary, hire_date)
VALUES (101, 'Maria Chen', 'Engineering', 95000, '2024-03-10');

Result:

Query OK, 1 row affected

The explicit-column version keeps working even if someone later adds a new column to the table (like an email column) — the value-only version would then insert into the wrong columns or fail outright.

Inserting Multiple Rows at Once

Most databases let you insert several rows in a single statement by separating value groups with commas. This is noticeably faster than running a separate INSERT per row, since the database only has to parse and plan the statement once.

INSERT INTO employees (id, name, department, salary, hire_date)
VALUES
  (102, 'Tom Rivera', 'Sales', 61000, '2024-01-15'),
  (103, 'Lena Park',   'Sales', 63500, '2024-02-01');

Result:

Query OK, 2 rows affected

Omitted Columns Get Defaults or NULL

Any column you don't mention in the column list will be filled with its declared DEFAULT value, or with NULL if no default exists — unless that column has a NOT NULL constraint, in which case the insert fails with an error.

-- department left out entirely — becomes NULL
INSERT INTO employees (id, name, salary, hire_date)
VALUES (104, 'Sam Okafor', 58000, '2024-04-05');

Once you understand how to add rows, the natural next step is changing existing ones with the UPDATE statement, which follows very similar column-list thinking but needs a careful WHERE clause to avoid touching rows you didn't mean to.