1. 程式人生 > >03 mysql補充 (進階)

03 mysql補充 (進階)

color 增加字段 div char ren tab mys var 表名

增加字段

alter table tb1 add age int first; 增加到第一

alter table tb1 add sex int after id; # 改變位置,id是字段名字

alter table tb1 modify age varchar(10); # 修改類型

alter table tb1 change age sex varchar(10); # 更改字段,類型不變

alter table tb1 tb1 rename ta2; # 更改表名字

alter table tb1 drop age; # 刪除字段

drop user 用戶名 # 刪除用戶

03 mysql補充 (進階)