1136ERRORTier 1 — Safe✅ HIGH confidence

Column count doesn't match value count

Category: Syntax ErrorVersions: All MariaDB / MySQL versions

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
CREATE TABLE users (id INT, email VARCHAR(255));
INSERT INTO users VALUES (1, 'alice@example.com', 'extra_value');
ERROR 1136 (21S01): Column count doesn't match value count at row 1

Fix 1: Explicitly list the target columns

Always — explicit column lists make INSERTs robust against schema changes.

fix
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

Why it's wrong: 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 versionsStable error code. The row number is included in the error message when multiple rows are inserted with a single statement.

Sources

📚 Official docs: https://mariadb.com/kb/en/insert/

🔧 Source ref: MariaDB Server error code 1136 / ER_WRONG_VALUE_COUNT_ON_ROW

📖 Further reading: MariaDB INSERT syntax

Confidence assessment

✅ HIGH confidence

Stable.

See also

📄 Reference pages

INSERT syntaxexplicit column lists
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →