您的位置:首页 > 数据库 > MySQL

MySQL在指定列之前或之后插入列 (Add a column to an existing MySQL table)

2013-08-22 18:15 281 查看
转自:http://www.tech-recipes.com/rx/378/add-a-column-to-an-existing-mysql-table/

To add a column called email to the contacts table created in
Create a basic MySQL table with a datatype of VARCHAR(80), use the following SQL statement:

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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐