1136
MySQLERRORCommonSyntax ErrorHIGH confidence

Column count doesn't match value count

What this means

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.

Why it happens
  1. 1INSERT INTO t VALUES (...) with the wrong number of values for the table column count
  2. 2INSERT INTO t (col1, col2) VALUES (val1, val2, val3) — more values than columns listed
  3. 3An INSERT ... SELECT where the SELECT returns a different number of columns than the INSERT column list
How to reproduce

An INSERT provides three values for a two-column table.

trigger — this will error
trigger — this will error
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.

Explicitly list the target columns
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.

What not to do

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.

Version notes
All versions

Stable error code. The row number is included in the error message when multiple rows are inserted with a single statement.

Sources
Official documentation ↗

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

← All MySQL errors