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

版权声明:本文为HistoryCreator原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。