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:
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:
If you want the new column to be first, use this statement:
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;
相关文章推荐
- MySQL: How to add column to existing table
- Mysql官方文档中争对安全添加列的处理方法。Mysql Add a Column to a table if not exists
- MySQL错误:Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL easonjim
- MS SQL Server - How to change an existing column to auto-increment column
- 【MySQL笔记】解除输入的安全模式,Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect.
- 插入mysql语句报错:1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- Add column to existing table with default value
- MySql Query To Get Important Column Properties Of A Table
- Add a Web site as a portal to an existing team project
- Mysql Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
- can't add a _parent field that points to an already existing type
- ssh开发中插入数据时遇到 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
- Mysql官方文档中争对安全添加列的处理方法。Mysql Add a Column to a table if not exists
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
- How To Partition Existing Table Using DBMS_Redefinition
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- How to Change the MySQL Time Zone on an Ubuntu Server
- MySql 执行语句错误 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- How to dump an ACPI table on Linux/OpenSolaris