MySQL 命令操作数据表

MySQL 命令操作数据表

1.查看表信息

desc hs_user_credit_info;

2.新增表字段

alter table hs_credit_order add search_relation_names varchar(80) comment '尽调主体关联人-查询对象关联关系' ;

3.修改字段是否为null,修改描述:

alter table hs_user_credit_info modify credit_status int not null comment '状态:0风控审批结束 1有效 2作废 3过期';

4.修改字段名:

alter table student change physics physisc char(10) not null;

5.刷新表数据,但是不想更新修改时间

alter table hs_loan_order modify modify_time timestamp not null default CURRENT_TIMESTAMP;
 
-- update ....

alter table hs_loan_order modify modify_time timestamp not null default CURRENT_TIMESTAMP  ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间';

就是修改modify_time的默认值

本来的想法是直接去掉默认值

alter table hs_loan_order alter column modify_time  drop default;

发现这样只能去除创建时更新时间更新,不能去除update时的刷新。

可以通过下面语句查看:

 desc hs_loan_order;

参考:

https://www.cnblogs.com/zsg88/p/7818684.html
https://www.cnblogs.com/huangxm/p/5736807.html

原文地址:https://www.cnblogs.com/hongdada/p/9555308.html