首頁 > 資料庫 > mysql教程 > MySQL在指定列之前或之后插入列 (Add a column to an existing M

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
發布: 2016-06-07 15:34:08
原創
1741 人瀏覽過

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 c


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;
登入後複製


相關標籤:
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
linux安裝mysql報錯
來自於 1970-01-01 08:00:00
0
0
0
mysql 升級後無法重新啟動mysql服務的問題
來自於 1970-01-01 08:00:00
0
0
0
MySQL停止進程
來自於 1970-01-01 08:00:00
0
0
0
phpstudy不能啟動mysql?
來自於 1970-01-01 08:00:00
0
0
0
環境中mysql
來自於 1970-01-01 08:00:00
0
0
0
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板