Home » Mysql » MySQL – Rename Column

MySQL – Rename Column

Posted by: admin November 29, 2017 Leave a comment

Questions:

How to rename mysql column from help to content in my table tbl_help

mysql_query("ALTER TABLE tbl_help " . "CHANGE COLUMN help content;");
Answers:

You’ve got to include the definition of the column in the change column statement (not sure why, but that’s what the documentation says.)

So this should work:

mysql_query("ALTER TABLE tbl_help " . "CHANGE COLUMN help content VARCHAR(200) ;");

Questions:
Answers:

From mySql Doc pages:

You can rename a column using a CHANGE old_col_name new_col_name column_definition clause.