MySQL: How to add a new column to an existing table



by Sarah Watts on May 28, 2008

Do you want to add a new column to an existing table in MySQL. You cannot only add a new column, you can even decide the positioning of the column in your MySQL database table. For instance, if you want to add a new column in the last, you merely use this command:

alter table mytable add column new_column_name varchar(255)

If you want the new column to be the first column you use this command:

alter table mytable add new column new_column_name varchar(255) first

And if you want this new column to appear after an already existing column you do the following:

alter table mytable add new column new_column_name after older_column_name


Technorati Tags:
  • Stumbleupon
  • Delicious
Share

Related posts

  • No Related Post

{ 2 comments… read them below or add one }

roger mill May 19, 2009 at 11:27 pm

Best places to play, best strategies to win. Player ratings & reviews of top online casinos & pokers with highest payouts & biggest bonuses.

Narmadha July 18, 2009 at 5:18 am

Upto to the requirement.
Crisp and clear.

Leave a Comment

Previous post: How to make accurate time estimates when starting new projects

Next post: How to make your writing crisp and lean