目录
修改表名以及字段的基本操作
1.查看数据表的创建信息
show create table 表名/G;
上面有看不懂的代码,上期博客有哦!
2.查看数据表字段信息
desc 表名;
3.修改表名(to可省略)
alter table 表名 rename to 新表名;
4.修改字段名和数据类型
alter table 表名 change 原字段名 新字段名 新数据类型; ( 新数据类型----可改可不改)
5.添加字段
1.alter table 表名 add 字段名 数据类型; (添加在末端)
2.alter table 表名 add 字段名 数据类型 frist; (添加在首端)
3.alter table 表名 add 字段名 数据类型 after 已存在的字段名; (在指定字段之后添加字段)
6.删除字段名
alter table 表名 dorp 字段名;
7.修改字段排列位置
alter table 表名 modify 待修改字段名 数据类型 after 字段名;