What's the mysql syntax to rename column in a table?

I try this:

 ALTER TABLE static_content RENAME COLUMN title TO shorttext 

MySQL said: Documentation

#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 'COLUMN title TO shorttext' at line 1 

Edited by Dani: Formatting fixed

3 Years
Discussion Span
Last Post by ugi.nagesh
Featured Replies
  • 1

    http://dev.mysql.com/doc/refman/5.1/en/alter-table.html RENAME is for tables. ALTER TABLE static_content CHANGE COLUMN title shorttext VARCHAR(255) Adjust the column type accordingly. Read More

  • 1

    @ling_tj, @anas.man: `RENAME COLUMN` is Oracle syntax, not MySQL. Read More


alter table <tablename> rename column <oldname> to <newname>

Ex : ALTER TABLE emp RENAME COLUMN emp_name to employee_name;


To rename a column called "Column_Old" to "Column_New" in the table named "customer":

mysql> alter table customer change Column_Old Column_New int(3) unsigned;

So, when renaming a column, we need to provide the old column name first, then after the new column name.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.