0
点赞
收藏
分享

微信扫一扫

MySQL数据库(6):修改数据表

慕容冲_a4b8 2022-04-23 阅读 105
mysql

一.修改表名:

将表old_table改为new_table

alter table new_table rename to old_table;

二.修改字段名:

将id改为stu_id

alter table old_table change id stu_id int;

三.修改字段类型:

将stu_id的类型改为tinyint类型

alter table old_table modify stu_id tinyint;

四.添加字段:

添加一个ages字段

alter table old_table add ages tinyint;

五.删除字段:

删除ages字段

alter table old_table drop ages;

 

举报

相关推荐

0 条评论