紧当数据创建时设置值
alter table tbl_books modify create_time datetime not null default current_timestamp
当数据被修改时该字段自动更新
alter table tableName add update_time datetime not null default current_timestamp on update current_timestamp
修改主键自动增加
alter table tbl_books modify id bigint auto_increment
本文介绍如何使用SQL语句来实现字段的自动填充当前时间戳,包括数据创建时的默认值设置以及数据更新时的时间自动更新。此外,还展示了如何修改表中的主键字段为自增长类型。
174万+

被折叠的 条评论
为什么被折叠?



