当前位置: 首页 > news >正文

MySQL、Oracle的时间类型字段自动更新:insert插入、update更新时,自动更新时间戳

1.MySQL

  • 支持的字段类型:DATETIME、TIMESTAMP
drop table if exists test_time_auto_update;
create table test_time_auto_update
(id         bigint auto_increment primary key                               comment '自增id',name       varchar(8)                                                      comment '姓名',datetime1  datetime  default current_timestamp                             comment 'insert        时,更新时间',datetime2  datetime                            on update current_timestamp comment '       update 时,更新时间',datetime3  datetime  default current_timestamp on update current_timestamp comment 'insert/update 时,更新时间',timestamp1 timestamp default current_timestamp                             comment 'insert        时,更新时间',timestamp2 timestamp                           on update current_timestamp comment '       update 时,更新时间',timestamp3 timestamp default current_timestamp on update current_timestamp comment 'insert/update 时,更新时间'
) comment = '测试自动更新时间';

参考

MYsql 和Oracle 的时间类型字段自动更新

http://www.lryc.cn/news/323787.html

相关文章:

  • Testng框架集成新业务
  • springboot 单元测试
  • LeetCode---126双周赛
  • [python] ETL 工作流程 Prefect
  • html第一次作业
  • 基于java实现的KTV点歌系统
  • GPT+向量数据库+Function calling=垂直领域小助手
  • DeepSeek-coder 微调训练记录
  • 【Android】【Bluetooth Stack】蓝牙音乐协议分析之音频控制与信息加载(超详细)
  • ChatGPT无法登录,提示我们检测到可疑的登录行为?如何解决?
  • 程序员表白
  • CSS的使用与方法
  • (保姆级)离线安装mongoDB集群
  • 面试笔记——MySQL(主从同步原理、分库分表)
  • 面试题2.0
  • 【剑指offer】53. 最小的k个数(java选手)(优先队列+快排+快速选择)
  • 带有GUI界面的电机故障诊断(MSCNN-BILSTM-ATTENTION模型,TensorFlow框架,有中文注释,带有六种结果可视化)
  • 【技术栈】Spring Cache 简化 Redis 缓存使用
  • 解决wrap_socket() got an unexpected keyword argument ‘ciphers‘
  • 【力扣hot100】128.最长连续序列
  • css的text-shadow详解
  • Qt 利用共享内存实现一次只能启动一个程序(单实例运行)
  • 【生活知识-茶叶】
  • [AIGC] 在Spring Boot中指定请求体格式
  • 4核16G服务器租用优惠价格,26.52元1个月,半年149元
  • 2024 Mazing 3 中文版新功能介绍Windows and macOS
  • npm设置淘宝镜像
  • 现代卷积神经网络
  • 【wubuntu】披着Win11皮肤主题的Ubuntu系统
  • Kubernetes自动化配置部署