MySQL“简单”错误理解(MySQL “simple” error understanding)

编程入门 行业动态 更新时间:2024-10-23 15:19:05
MySQL“简单”错误理解(MySQL “simple” error understanding)

我有一个非常简单的要求:

SELECT * FROM players;

它起作用并显示“玩家”列表。 现在,如果我在名为“groups”的表上执行完全相同的请求,则会出现语法错误

SELECT * FROM groups;

错误代码:1064。您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在第1行0.000秒的“组”附近使用正确的语法

如果我做 :

SELECT * FROM mydb.groups;

它有效,如果我这样做:

SELECT * FROM `groups`;

它也有效。

i have a very simple request :

SELECT * FROM players;

which works and show a list of "players". Now if i do the exact same request on my table named "groups" i get a syntax error

SELECT * FROM groups;

Error Code: 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 'groups' at line 1 0.000 sec

If I do :

SELECT * FROM mydb.groups;

It works and if I do :

SELECT * FROM `groups`;

It works too.

最满意答案

GROUPS是保留关键字(在8.0.2(保留)中添加了GROUPS(R)):

https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-G

GROUPS is a reserved keywords (GROUPS (R) added in 8.0.2 (reserved)) :

https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-G

更多推荐

本文发布于:2023-08-01 11:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1358069.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   简单   MySQL   understanding   error

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!