mysql 在指定的字段后面追加字段

本文详细介绍了SQL中用于修改表结构的语句,包括如何添加新字段、指定字段属性和注释,以及字段位置调整。示例包括altertable语句的使用,如添加error_code、hold、profit和weight字段,并解释了各参数的意义和位置要求。
摘要由CSDN通过智能技术生成

举个栗子:alter table inquiry add error_code varchar(3) after add_time;

说明:alter table + 表名 + add + 要添加的字段 字段类型 + after + 要跟随的字段名

 
 

alter table t_adviser_info add hold int COMMENT '0持有,1未持有' after stockname

alter table t_adviser_info add profit int comment "0盈利,1亏损" after hold

alter table t_adviser_info add weight int comment "0轻仓,1重仓" after profit

注意 Int,comment,和after 的位置

alter table tablename add column columnname varchar(64) not null after somecolumn;

tablename指的是表名,columnname指的是新增字段名,somecolumn指的是表中原有的字段。no null 表示新增字段不能为空。varchar(64) 设置新增字段类型和长度。

    
    alter table image_approval_result  add customerType int comment "0投保人,1被保人" after customerNo;
    alter table image_approval_result  add sceName varchar(20) comment "人脸的场景编码" after busType;

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值