1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Alter Table - MySQL Command


Hands typing on a laptop
Blackred/E+/Getty Images
Top Related Searches
  • drop column
  • column name
  • 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.




    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.




    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 Video
    Using PHP With HTML
    1. About.com
    2. Technology
    3. PHP / MySQL
    4. MySQL Commands
    5. Alter Table - MySQL Command

    ©2014 About.com. All rights reserved.