sql 添加 default 约束

创建表时添加表约束

create table table_name (
id int primary key auto_increment, 
actionTime datetime default current_timestamp); // 添加默认时间

为当前的表中的字段添加默认约束

alter table table_name modify actionTime datetime default current_timestamp;

猜你喜欢

转载自blog.csdn.net/ff_hh/article/details/88126520
今日推荐