Samstag, 19. Juli 2008

MySQL: Insert A Column

//Add a column & Primary key
alter table Generic, add (id_generic int not null auto_increment primary key);

ALTER TABLE contacts ADD email VARCHAR(60);


This first statement will add the email column to the end of the table. To insert the new column after a specific column, such as name, use this statement:

ALTER TABLE contacts ADD email VARCHAR(60) AFTER name;


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

ALTER TABLE contacts ADD email VARCHAR(60) FIRST;


http://www.tech-recipes.com/mysql_tips378.html

Keine Kommentare: