mysql中的alter命令用于修改数据表表名或修改数据表中的字段:
修改数据表名:
alter table runoob_tbl rename to runoob_table;
添加、删除或者修改数据表字段:
添加字段
alter table runoob_table add num bigint;
show columns from runoob_table;
修改字段名称:
alter table runoob_table change num tnum bigint;
show columns from runoob_table;
修改字段属性:
alter table runoob_table modify num tinyint;
show columns from runoob_table;
修改字段默认值:
alter table runoob_table alter tnum set default 100;
insert runoob_table(runoob_title,runoob_author) values("PS","RUNOOB");
select * from runoob_table;