MySql表字段修改记录
mysql修改表数据类型的方式
- 针对一个已经存在的列,修改类型,主要使用
modify
alter table xxx modify id int(11) unsigned not null auto_increment comment '主键id'
1
- 如果是希望新增一列,使用
add column
-- after 表示这个新增的列在id这一列之后
alter table xxx add column to_add varchar(11) not null default '' comment '新增的列' after `id`;
1
2
2
- 删除某一列,使用
drop column
-- 删除 xxx 这一列
alter table drop column xxx;
1
2
2
# II. 其他
# 1. 一灰灰Blog (opens new window): https://liuyueyi.github.io/hexblog
一灰灰的个人博客,记录所有学习和工作中的博文,欢迎大家前去逛逛
# 2. 声明
尽信书则不如,以上内容,纯属一家之言,因个人能力有限,难免有疏漏和错误之处,如发现bug或者有更好的建议,欢迎批评指正,不吝感激
- 微博地址: 小灰灰Blog (opens new window)
- QQ: 一灰灰/3302797840
# 3. 扫描关注
一灰灰blog
编辑 (opens new window)
上次更新: 2021/10/15, 19:56:22
- 01
- 【基础系列】基于maven多环境配置04-25
- 03
- 【搜索系列】ES查询常用实例演示04-18