MySQL 使用 ON UPDATE CURRENT_TIMESTAMP 自动更新 timestamp (转)
2024-09-18 13:01:06
原文地址: https://blog.csdn.net/heatdeath/article/details/79833492
`create_time` timestamp not null default current_timestamp comment '创建时间', `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
当执行update操作是,并且字段有ON UPDATE CURRENT_TIMESTAMP属性。则字段无论值有没有变化,它的值也会跟着更新为当前UPDATE操作时的时间。
参考资料:
1、timestamp的两个属性:CURRENT_TIMESTAMP 和ON UPDATE CURRENT_TIMESTAMP
https://blog.csdn.net/aitcax/article/details/41849591
最新文章
- android开发------第一个android程序
- Android UI基础之五大布局
- Permutations [LeetCode]
- 【转】代码编辑器(二)-SynEdit
- 算法导论(第三版) Exercises4.2(求最大和子数组的算法优化过程)
- sqlserver2005仅当使用了列的列表,并且 IDENTITY_INSERT 为 ON 时,才能在表 'SendMealAddress'中为标识列指定显式值。
- 用tomcat搭建web服务器
- 为什么你的Excel很丑?
- Gradle 1.12用户指南翻译——第五十二章. Maven 插件
- JS操作iframe元素
- BZOJ4827 [Hnoi2017]礼物 多项式 FFT
- flink基础教程读书笔记
- 自学Linux命令行与Shell脚本之路
- nginx中间件
- CentOS6.2(64bit)下mysql5.6.16主从同步配置
- Python 简单入门指北(一)
- 使用promise 和 generator来管理工作流
- LuoguP3834 【模板】可持久化线段树 1(主席树)|| 离散化
- Codeforces 801B - Valued Keys
- TP - 001