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