Search code examples
mysqlsyntaxmysql-error-1136

MySQL: Column count doesn't match value count. syntaxis error


I've looked at a couple questions similar to this, but none seem to be what I'm looking for. These are the values that I'm getting an error for.

insert into Artist(artistId, artistName)
values(
(1,"Artist1"),
(2,"Artist2"),
(3,"Artist3"),
(4,"Artist4"),
(5,"Artist5"),
(6,"Artist6"),
(7,"Artist7"),
(8,"Artist8"),
(9,"Artist9"),
(10,"Artist10"));

Is it possible that there is a syntax error further up in my code that could be causing this error?


Solution

  • Remove parentheses:

    insert into Artist(artistId, artistName)
    values
    (1,"Artist1"),
    (2,"Artist2"),
    (3,"Artist3"),
    (4,"Artist4"),
    (5,"Artist5"),
    (6,"Artist6"),
    (7,"Artist7"),
    (8,"Artist8"),
    (9,"Artist9"),
    (10,"Artist10");
    

    SqlFiddleDemo

    INSERT syntax:

    INSERT INTO tab(column_list)
    VALUES (row_1_value_list), (row_2_value_list), ...;