MySQL:列数与值计数不匹配。 syntaxis错误

时间:2015-12-04 17:29:26

标签: mysql syntax mysql-error-1136

我已经看过几个与此类似的问题,但似乎没有一个我正在寻找的问题。这些是我收到错误的值。

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"));

我的代码中是否存在可能导致此错误的语法错误?

1 个答案:

答案 0 :(得分:2)

删除括号:

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), ...;