Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql SQL语法错误插入到_Mysql_Sql - Fatal编程技术网

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——顺便说一下,这是一个糟糕的用户名