2020
MySQLERRORNotableDMLHIGH confidence

Column count does not match value count at row N

Production Risk

Low — INSERT is rejected; no data is modified.

What this means

In a multi-row INSERT statement, one or more rows have a different number of values than the number of columns specified. Every row in a multi-row INSERT must provide the same number of values.

Why it happens
  1. 1Multi-row INSERT where one row has fewer or more values than others.
  2. 2Copying data from a different table with a different column count.
  3. 3Missing comma or extra value in a row literal.
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t (a, b, c) VALUES (1, 2, 3), (4, 5); -- row 2 has 2 values, expected 3

expected output

ERROR 2020 (21S01): Column count doesn't match value count at row 2.

Fix

Ensure every row provides the correct number of values

Ensure every row provides the correct number of values
INSERT INTO t (a, b, c) VALUES (1, 2, 3), (4, 5, 6);

Why this works

Each row must provide a value (or DEFAULT/NULL) for every listed column.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 2020 ER_WRONG_VALUE_COUNT_ON_ROW

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors