SQL语法错误INSERT INTO

时间:2014-09-02 16:53:45

标签: mysql sql

INSERT INTO Group (Id, Nombre, Cerrado, PermisosLibres, PermisosAdministrados, Reciprocos, Chat, MinutosGrupo)
VALUES ('1', '1', '1', '1', '1', '1', '1', '1');

我不明白为什么会出现这种错误,我已经多次观看过,我看到没有失败。

enter image description here

我不明白为什么会出现这种错误,我已经多次观看过,我看到没有失败。

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Group (Id, Nombre, Cerrado, PermisosLibres, PermisosAdministrados, Reciprocos, C' at line 1 

2 个答案:

答案 0 :(得分:4)

您不能将Group用作表名,而是保留字。你需要使用带有反引号的“Group”

您的插入声明应为:

INSERT INTO `Group` (Id, Nombre, Cerrado, PermisosLibres, PermisosAdministrados, Reciprocos, Chat, MinutosGrupo)
VALUES ('1', '1', '1', '1', '1', '1', '1', '1');

答案 1 :(得分:1)

试试这个:

INSERT INTO `Group` (`Id`, `Nombre`, `Cerrado`, `PermisosLibres`, `PermisosAdministrados`, `Reciprocos`, `Chat`, `MinutosGrupo`)
VALUES ('1', '1', '1', '1', '1', '1', '1', '1');


添加了什么:

添加了backticks,因为Group是MySQL中的保留关键字。

相关问题