Lab-verifiedReproduced and fixed on MySQL 8.4.13 · 2026-11-29 · container image mysql:8.4
Without a column list, INSERT INTO t VALUES (…) must give a value for every column in the table, in table order, including AUTO_INCREMENT and DEFAULT columns. With a column list, each row must have exactly as many values as listed.
The at row N part tells you which row of a multi-row INSERT is wrong. The whole statement fails and no rows are inserted.
01INSERT without a column list skips AUTO_INCREMENT/DEFAULT columns
members has 4 columns (id, name, email, created_at), but INSERT INTO members VALUES ('Kim', 'kim@example.com') gives only 2 values. MySQL does not guess which columns they are for.
Setup
CREATE TABLE members (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), email VARCHAR(50), created_at DATETIME DEFAULT CURRENT_TIMESTAMP);Query OK, 0 rows affected (0.02 sec)INSERT INTO members VALUES ('Kim', 'kim@example.com');ERROR 1136 (21S01): Column count doesn't match value count at row 1SHOW COLUMNS FROM members;+------------+-------------+------+-----+-------------------+-------------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+-------------------+-------------------+
| id | int | NO | PRI | NULL | auto_increment |
| name | varchar(30) | YES | | NULL | |
| email | varchar(50) | YES | | NULL | |
| created_at | datetime | YES | | CURRENT_TIMESTAMP | DEFAULT_GENERATED |
+------------+-------------+------+-----+-------------------+-------------------+
4 rows in set (0.00 sec)List the columns: INSERT INTO members (name, email) VALUES (…). id is filled by AUTO_INCREMENT.
INSERT INTO members (name, email) VALUES ('Kim', 'kim@example.com');
SELECT id, name, email FROM members;Query OK, 1 row affected (0.00 sec)
+----+------+-----------------+
| id | name | email |
+----+------+-----------------+
| 1 | Kim | kim@example.com |
+----+------+-----------------+
1 row in set (0.00 sec)02A column was added to the table and old INSERT code breaks
products had 3 columns, then ALTER TABLE … ADD COLUMN category made it 4. An existing INSERT INTO products VALUES ('P100', 'Mouse', 15000) now fails.
Setup
CREATE TABLE products (code VARCHAR(10) PRIMARY KEY, name VARCHAR(30), price INT);
ALTER TABLE products ADD COLUMN category VARCHAR(20);Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0INSERT INTO products VALUES ('P100', 'Mouse', 15000);ERROR 1136 (21S01): Column count doesn't match value count at row 1SHOW COLUMNS FROM products;+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| code | varchar(10) | NO | PRI | NULL | |
| name | varchar(30) | YES | | NULL | |
| price | int | YES | | NULL | |
| category | varchar(20) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)SHOW COLUMNS shows the new category column. With an explicit column list (code, name, price) the INSERT works and category is NULL.
INSERT INTO products (code, name, price) VALUES ('P100', 'Mouse', 15000);
SELECT * FROM products;Query OK, 1 row affected (0.01 sec)
+------+-------+-------+----------+
| code | name | price | category |
+------+-------+-------+----------+
| P100 | Mouse | 15000 | NULL |
+------+-------+-------+----------+
1 row in set (0.00 sec)03One row in a multi-row INSERT is missing a value
The second row ('B200', 5) has 2 values for 3 columns, so the message says at row 2. SELECT COUNT(*) returns 0: rows 1 and 3 were not inserted either.
Setup
CREATE TABLE stock (item VARCHAR(10) PRIMARY KEY, qty INT, location VARCHAR(10));Query OK, 0 rows affected (0.01 sec)INSERT INTO stock (item, qty, location) VALUES ('A100', 10, 'W1'), ('B200', 5), ('C300', 7, 'W2');ERROR 1136 (21S01): Column count doesn't match value count at row 2SELECT COUNT(*) FROM stock;+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)Add the missing value to row 2. All 3 rows are inserted.
INSERT INTO stock (item, qty, location) VALUES ('A100', 10, 'W1'), ('B200', 5, 'W1'), ('C300', 7, 'W2');
SELECT * FROM stock ORDER BY item;Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
+------+------+----------+
| item | qty | location |
+------+------+----------+
| A100 | 10 | W1 |
| B200 | 5 | W1 |
| C300 | 7 | W2 |
+------+------+----------+
3 rows in set (0.00 sec)04INSERT … SELECT * into a table with a different number of columns
orders has 4 columns and the history table orders_hist has 3. INSERT INTO orders_hist SELECT * FROM orders sends 4 values per row.
Setup
CREATE TABLE orders (id INT PRIMARY KEY, customer VARCHAR(20), amount INT, status VARCHAR(10));
CREATE TABLE orders_hist (id INT PRIMARY KEY, customer VARCHAR(20), amount INT);
INSERT INTO orders VALUES (1, 'Kim', 5000, 'DONE');Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 1 row affected (0.00 sec)INSERT INTO orders_hist SELECT * FROM orders;ERROR 1136 (21S01): Column count doesn't match value count at row 1SELECT table_name, COUNT(*) AS columns FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name IN ('orders', 'orders_hist') GROUP BY table_name;+-------------+---------+
| TABLE_NAME | columns |
+-------------+---------+
| orders | 4 |
| orders_hist | 3 |
+-------------+---------+
2 rows in set (0.00 sec)Name the columns on both sides: INSERT INTO orders_hist (id, customer, amount) SELECT id, customer, amount FROM orders.
INSERT INTO orders_hist (id, customer, amount) SELECT id, customer, amount FROM orders;
SELECT * FROM orders_hist;Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
+----+----------+--------+
| id | customer | amount |
+----+----------+--------+
| 1 | Kim | 5000 |
+----+----------+--------+
1 row in set (0.00 sec)FAQ
How do I fix MySQL error 1136?
Write the column list in the INSERT and give exactly one value per listed column in every row.
Do I have to include the AUTO_INCREMENT id in INSERT?
Only if you omit the column list. With INSERT INTO t (col1, col2) VALUES (...) you can leave id out and it is generated.
What does 'at row 2' mean?
It is the second row in the VALUES list (or SELECT result). Check that row's number of values.
Why did my INSERT break after ALTER TABLE ADD COLUMN?
An INSERT without a column list must match all columns, including the new one. Adding a column list makes it independent of later columns.
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary users created for the test, each with full rights on a database of the same name (its default database); root is the administrator. MySQL 8.4.13