Dave's Brain

Browse - Computer Tips - How do I rename a column in MySQL?

Date: 2009feb11
Keywords: sql

Q.  How do I rename a column in MySQL?

A.  As far as I know you have to specify the new type
when renameing a column.  So its like this:

ALTER TABLE <table> CHANGE <old-col> <new-col> <new-type>;
eg:
ALTER TABLE mytable CHANGE oldcol newcol VARCHAR(255);

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.