I have a simple, yet seemingly too simple question:I know that you can rename tables in a MySQL database with the ALTER TABLE statement...but can you rename a column somehow? Or do you have to drop it and re-add it? I really don't want to do that, but I will if I absolutely have to.
You can rename a column using a CHANGE old_col_name create_definition clause. To do so, specify the old and new column names and the type that the column currently has. For example, to rename an INTEGER column from a to b, you can do this:
mysql> ALTER TABLE t1 CHANGE a b INTEGER;
Last edited by DR_LaRRY_PEpPeR; Jul 2, 2001 at 19:56.
Bookmarks