1. Computing & Technology

Discuss in my forum

Alter Table - MySQL Command

By , About.com Guide

Drop Column:

 alter table icecream drop column flavor ;
Drop Column is used to remove an entire column and all its data from a table.

Add Column:

alter table icecream add column flavor varchar (20) ; 
Add Column is used to add a column to your existing table.

Change:

alter table icecream change taste flavor varchar (10) ; 
Change is used to change the column name. In our example it changes "taste" to be "flavor".

Add Unique:

 alter table icecream add unique (quantity)
Add unique adds a new column to your table only if it does not already exist.

Modify:

alter table icecream modify flavor VARCHAR(35) ; 
Modify is used to change a column's size. In our example we increase the size of the "flavor" column to 35 characters.
Related Searches drop column column name

©2012 About.com. All rights reserved.

A part of The New York Times Company.