MySQL“简单"错误理解 [英] MySQL "simple" error understanding

查看:54
本文介绍了MySQL“简单"错误理解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

SELECT * FROM 玩家;

它可以工作并显示玩家"列表.现在,如果我在名为groups"的表上执行完全相同的请求,则会出现语法错误

SELECT * FROM 组;

<块引用>

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

如果我这样做:

SELECT * FROM mydb.groups;

它有效如果我这样做:

SELECT * FROM `groups`;

它也有效.

解决方案

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

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

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 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

这篇关于MySQL“简单"错误理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆