mysql 追加update_time、create_time、id三字段

紧当数据创建时设置值

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

猜你喜欢

转载自blog.csdn.net/historycreator/article/details/78636905