[英]syntax error when trying to alter table column name mysql
I am working on a homework assignment.我正在做家庭作业。 my instructions are this:
我的指示是这样的:
In the MATCHES table, change the column name MATCHNO to MATCH.在 MATCHES 表中,将列名 MATCHNO 更改为 MATCH。
my syntax i wrote will be below, the problem I am having is with the word "match" its giving me a syntax error of unexpected syntax error for it.我写的语法将在下面,我遇到的问题是“匹配”这个词给了我一个意外语法错误的语法错误。 I am assuming that match is a keyword of some sort but after googling I'm not sure exactly.
我假设 match 是某种关键字,但在谷歌搜索后我不确定。
the database I am using is the popular "tennis" one for teachings.我使用的数据库是用于教学的流行“网球”数据库。
here is my code:这是我的代码:
sql sql
ALTER TABLE MATCHES
CHANGE MATCHNO MATCH INT;
what can I do to fix this?我能做些什么来解决这个问题? If i change the name of "match" to something else it works but my instructions say to use "match"... is this possible?
如果我将“匹配”的名称更改为其他名称,它会起作用,但我的说明说使用“匹配”……这可能吗?
The problem is that your query contains MySQL keywords ( MATCH
, cf. https://dev.mysql.com/doc/refman/5.5/en/keywords.html ).问题是您的查询包含 MySQL 关键字(
MATCH
,参见https://dev.mysql.com/doc/refman/5.5/en/keywords.html )。
Put the table and column names in backticks (`) in order to prevent MySQL from interpreting those as keywords.将表名和列名放在反引号 (`) 中,以防止 MySQL 将它们解释为关键字。
ALTER TABLE `MATCHES` CHANGE `MATCHNO` `MATCH` INT;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.