回顾建表语句
create table 表名 (
列名称 列类型 [列属性] [默认值], //例如primary key auto_increment
列名称 列类型 [列属性] [默认值], //建表就是一个列声明的过程
列名称 列类型 [列属性] [默认值],
);
先说修改表名:
alter table 表名 rename 新表名;
增加列:
alter table 表名 add 列声明;
例如:alter table boy add height tinyint unsigned not null default 149;
增加列默认在表的最后一列。
如果想要声明新增的列在哪一列后面,可以用after。如果新增的列放在最前面,可以用first。
alter table boy add age tinyint unsigned not null default 22 after flower; 如下,新增的age列就在flower列后面了。
修改列:
alter table test change column address address1 varchar(30)--修改表列名
1399



被折叠的 条评论
为什么被折叠?



