mysql管理表(修改表结构)
Posted 吾矣
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql管理表(修改表结构)相关的知识,希望对你有一定的参考价值。
-添加列-
alter table student
add column class char null;
//修改student表结构,增加字段class,数据类型为char型,默认为空值.
-修改默认值-
alter table student
alter class
set default 1;
//修改class的默认值为1。
-对列重命名-
alter table student
change class classno int;
//将字段名class改成classno,数据类型为int型。
-修改列类型-
alter table student
modify classno char;
//修改classno列类型为char型。
-删除列-
alter table student
drop classno;
//删除字段classno。
-重命名表-
alter table student
rename student1;
//将student表重命名为student1。
吾矣
终极愿望世界和平୧⍤⃝
以上是关于mysql管理表(修改表结构)的主要内容,如果未能解决你的问题,请参考以下文章