实现建表时对应字段(修改时间)自动生成当时系统时间

Posted shouyaya

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实现建表时对应字段(修改时间)自动生成当时系统时间相关的知识,希望对你有一定的参考价值。

在建表时:

`create_time` timestamp not null default current_timestamp comment创建时间,--将系统当前时间设为默认值
`update_tiem` timestamp not null default current_timestamp on update current_timestamp comment修改时间,   --将系统当前时间设为默认值,同时更新时替换为更新时的系统时间

 

将系统当前时间设为默认值

以上是关于实现建表时对应字段(修改时间)自动生成当时系统时间的主要内容,如果未能解决你的问题,请参考以下文章