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

阅读 105

2022-04-23

一.修改表名:

将表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)

0 0 举报