Michael Peter Michael Peter - 5 months ago 50
SQL Question

Rename a column in mysql

I am trying to rename a column in mysql community server 5.5.27 using this SQL

Alter table tablename rename column oldcolname to newcolname;

I also tried

Alter table tablename rename oldcolname to newcolname;

But it says error check the Manual that corresponds to your Mysql server version


Use the following query:

ALTER TABLE tableName CHANGE "oldcolname" "newcolname" datatype(length);

The RENAME function is used in Oracle databases.

ALTER TABLE tableName RENAME COLUMN "oldcolname" TO "newcolname" datatype(length);