1. Computing

Discuss in my forum

How to Change a Column Name in MySQL

Renaming a column in a MySQL Database

By , About.com Guide

If you have already created your MySQL database, and decide after the fact that one of your columns is named incorrectly, you don't need to remove it and make a replacement, you can simply rename it.

You rename a column in MySQL using alter table and change. Let's say our column is currently named soda but you decide that beverage would be a more appropriate title. This column is located on the table called menu. Here is an example of how to change it:


alter table menu change soda beverage varchar (10) ;
In a more generic fashion, this would be:

alter table tablename change oldname newname varchar (10) ;
Also, obviously the varchar (10) can change to be appropriate for your column.
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. Learn MySQL
  5. Change a Column Name in MySQL

©2013 About.com. All rights reserved.