Mysql SQL语法错误插入到
我不明白为什么会发生这种错误,我已经看了很多遍,我没有看到失败Mysql SQL语法错误插入到,mysql,sql,Mysql,Sql,我不明白为什么会发生这种错误,我已经看了很多遍,我没有看到失败 INSERT INTO Group (Id, Nombre, Cerrado, PermisosLibres, PermisosAdministrados, Reciprocos, Chat, MinutosGrupo) VALUES ('1', '1', '1', '1', '1', '1', '1', '1'); 我不明白为什么会发生这种错误,我已经看了很多遍,我没有看到失败 INSERT INTO Group (Id, N
INSERT INTO Group (Id, Nombre, Cerrado, PermisosLibres, PermisosAdministrados, Reciprocos, Chat, MinutosGrupo)
VALUES ('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');
不能将
Group
用作表名,因为它是保留字。您需要将'Group'与backticks一起使用
您的insert语句应该是:
#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
试试这个:
INSERT INTO `Group` (Id, Nombre, Cerrado, PermisosLibres, PermisosAdministrados, Reciprocos, Chat, MinutosGrupo)
VALUES ('1', '1', '1', '1', '1', '1', '1', '1');
新增内容:
添加了
backticks
,因为Group
在MySQL中是一个保留关键字。Group
是一个关键字,您必须在其周围添加backticks。错误消息中确实有线索。”“Near”是“恰好在”的委婉说法。更好的办法是完全避免使用保留字。只有大约220个,所以很容易做到!不,他需要用反勾。这是MySQL,不是SQL Server。好的,谢谢@fancyPants——顺便说一下,这是一个糟糕的用户名