MySQL从“组"更改列名称到"group_code" [英] Mysql change column name from "group" to "group_code"
本文介绍了MySQL从“组"更改列名称到"group_code"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将列名设置为"group",这实际上是一个保留字.现在,我尝试将名称更改为"group_code",但出现错误.我尝试:
I have set a column name to "group", which turned out to be a reserved word. Now I try to change the name to "group_code", but I get an error. I try:
ALTER TABLE task_values CHANGE group group_code VARCHAR(40) NOT NULL;
和
ALTER TABLE task_values CHANGE 'group' group_code VARCHAR(40) NOT NULL;
但是都失败了,我收到没有这样的元素"错误.请帮助
but both fail, I get "No such element" error. Please help
推荐答案
您将需要在group
周围使用反引号,正如您所说的,它是 mysql保留关键字
You will need to use backticks around group
which, as you said, is a mysql reserved keyword
ALTER TABLE task_values CHANGE `group` group_code VARCHAR(40) NOT NULL;
这篇关于MySQL从“组"更改列名称到"group_code"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文