MySQL error 1136: Column count doesn't match value count
An INSERT gives a different number of values than columns: the column list and the VALUES row (or the SELECT) don't line up.
- Error number
1136- Name
ER_WRONG_VALUE_COUNT_ON_ROW- SQLSTATE
21S01- Category
- Syntax and statements
What it means
Each row in VALUES, or each row of an INSERT ... SELECT, must have exactly one value per target column. Without a column list, the target is every column of the table, in table order. 1136 names the first row that doesn't fit.
Common causes
INSERT INTO t VALUES (...)without a column list, after a column was added to the table.- A missing or extra value, or a stray comma.
INSERT ... SELECTwhose select list has a different number of columns.
How to fix it
-
Always name the columns, so later schema changes don't break the statement.
INSERT INTO customers (name, email) VALUES ('Ada', '[email protected]'); -
Check the table's columns and their order.
SHOW COLUMNS FROM customers;
Reproduce it safely
CREATE TEMPORARY TABLE t (a INT, b INT); INSERT INTO t VALUES (1); -- ERROR 1136 (21S01)
Related errors
More syntax and statements errors
1064You have an error in your SQL syntax1149SQL syntax error1052Column is ambiguous1055Expression isn't in GROUP BY1093Can't specify target table for update1242Subquery returns more than 1 row1248Every derived table must have its own alias1318Incorrect number of arguments
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.