#粤嵌星计划,粤嵌我来了#
#粤嵌星计划,粤嵌我来了#
1、添加字段
alter table 表名 add 字段名 字段类型
例如:
alter table student add chinese int;
2、修改字段
(1)修改字段类型
alter table 表名 modify 字段名 字段类型
例如:
alter table student modify chinese decimal(5,2);
(2)修改字段名
alter table 表名 change 旧字段名 新字段名 (字段类型,默认为原类型,也可改为新类型)
例如:
alter table student change chinese math;
3、删除字段
alter table 表名 drop 字段名
例如:
alter table student drop math;
4、修改表名
rename table 原表名 to 新表名
例如:
rename table student to students;