创建表的时候添加

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;可将时间转化为秒来参与语句对比

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
相关资源
相似解决方案