Question

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;

and

ALTER TABLE task_values CHANGE 'group' group_code VARCHAR(40) NOT NULL;

but both fail, I get "No such element" error. Please help

Was it helpful?

Solution

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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top