03 mysql补充 (进阶)

Posted zcmq

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 用户名 # 删除用户

以上是关于03 mysql补充 (进阶)的主要内容,如果未能解决你的问题,请参考以下文章