首页
学习
活动
专区
圈层
工具
发布

mysql修改、增加、删除字段名等命令

Mysql 一、.mysql修改 1.修改字段类型、字段名、字段注释、字段默认值 #修改字段类型、字段注释、字段默认值 ALTER TABLE 表名 MODIFY [COLUMN] 字段名 新数据类型...-- COLUMN关键字可以省略不写 alter table box modify column boxnum varchar(40) not null comment '编号' 2.修改字段名 mysql...ALTER TABLE 表名 ADD COLUMN newname 数据类型 数据长度 默认值 注释 //增加一个字段,默认为空 alter table box add column boxroom...int 10 default null comment '座位空间' //增加一个字段,默认不为空 alter table box add column boxroom int 10 not null...comment '座位空间' 7.删除字段 ALTER TABLE 表名 DROP [COLUMN] 字段名 ; --COLUMN关键字可以省略不写 alter table box drop boxroom

4.3K20
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到
    领券