03 mysql补充 (进阶)

增加字段

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 用户名 # 删除用户

猜你喜欢

转载自www.cnblogs.com/zcmq/p/9165225.html