alter table tbl_name add col_name type
例如,給表增加一列weight
mysql>alter table pet add weight int
刪除列
alter table tbl_name drop col_name
例如,刪除列weight:
mysql>alter table pet drop weight
改變列
alter table tbl_name modify col_name type
例如,改變weight的類型:
mysql> alter table pet modify weight samllint
另一種方法是:
alter table tbl_name change old_col_name col_name type
例如:
mysql> alter table pet change weight weight samllint
給列更名
mysql>alter table pet change weight wei
給表更名
alter table tbl_name rename new_tbl
例如,把pet表更名為animal
mysql>alter table pet rename animal
標簽:
weight
alter
table
add
上傳時間:
2013-12-06
上傳用戶:離殤