MySQL如何向表中增加、修改字段
生活随笔
收集整理的這篇文章主要介紹了
MySQL如何向表中增加、修改字段
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
alter table 表名 add 字段名 數據類型 default 默認值
說明:數據類型如,varchar(50)
alter table BANK_SOKECT_INFO ADD COLUMN DEPTNO varchar(8);
如何刪除表中字段
ALTER table 表名 DROP column 字段名
ALTER TABLE — 更改表屬性
語法
ALTER TABLE table [ * ]
ADD [ COLUMN ] column type
ALTER TABLE table [ * ]
ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT }
ALTER TABLE table [ * ]
RENAME [ COLUMN ] column TO newcolumn
ALTER TABLE table
RENAME TO newtable
ALTER TABLE table
ADD table constraint definition
Inputs
table
試圖更改的現存表的名稱.
column
現存或新的列名稱.
type
新列的類型.
newcolumn
現存列的新名稱.
newtable
表的新名稱.
table constraint definition
表的新的約束定義. New table constraint for the table輸出
ALTER
從被更名的列或表返回的信息.
ERROR
如果一個列或表
說明:數據類型如,varchar(50)
alter table BANK_SOKECT_INFO ADD COLUMN DEPTNO varchar(8);
如何刪除表中字段
ALTER table 表名 DROP column 字段名
ALTER TABLE — 更改表屬性
語法
ALTER TABLE table [ * ]
ADD [ COLUMN ] column type
ALTER TABLE table [ * ]
ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT }
ALTER TABLE table [ * ]
RENAME [ COLUMN ] column TO newcolumn
ALTER TABLE table
RENAME TO newtable
ALTER TABLE table
ADD table constraint definition
Inputs
table
試圖更改的現存表的名稱.
column
現存或新的列名稱.
type
新列的類型.
newcolumn
現存列的新名稱.
newtable
表的新名稱.
table constraint definition
表的新的約束定義. New table constraint for the table輸出
ALTER
從被更名的列或表返回的信息.
ERROR
如果一個列或表
總結
以上是生活随笔為你收集整理的MySQL如何向表中增加、修改字段的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MATLAB控制运算精度
- 下一篇: matlab out of memory