创建表的时候添加

CREATE TABLE `tmp` (   `id` varchar(32) NOT NULL,  `update_time ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP  )

 

添加此类时间字段

alter table XXX add update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

 

====================================================================

mysql时间对比

TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP(), update_time)) >= 86400;可将时间转化为秒来参与语句对比

相关文章: