Column count doesn't match value count
Error 1136 (SQLSTATE 21S01) is raised when an INSERT statement specifies a different number of values than there are columns in the target list. This is a compile-time check performed before any data is written.
- 1INSERT INTO t VALUES (...) with the wrong number of values for the table column count
- 2INSERT INTO t (col1, col2) VALUES (val1, val2, val3) — more values than columns listed
- 3An INSERT ... SELECT where the SELECT returns a different number of columns than the INSERT column list
An INSERT provides three values for a two-column table.
CREATE TABLE users (id INT, email VARCHAR(255)); INSERT INTO users VALUES (1, 'alice@example.com', 'extra_value');
expected output
ERROR 1136 (21S01): Column count doesn't match value count at row 1
Fix
Explicitly list the target columns
WHEN Always — explicit column lists make INSERTs robust against schema changes.
INSERT INTO users (id, email) VALUES (1, 'alice@example.com');
Why this works
Listing the column names makes the mapping between values and columns explicit. If a column is added to the table later, the INSERT continues to work correctly without modification.
✕ Use INSERT INTO t VALUES (...) without column names
Positional INSERTs break silently when columns are added, reordered, or removed from the table — producing 1136 or, worse, inserting data into the wrong columns.
Stable error code. The row number is included in the error message when multiple rows are inserted with a single statement.
MariaDB Server error code 1136 / ER_WRONG_VALUE_COUNT_ON_ROW
MariaDB INSERT syntax ↗Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev