When is a timestamp (auto) updated?

前端 未结 5 1404
慢半拍i
慢半拍i 2020-11-30 22:56

If I have a column in a table of type TIMESTAMP and has as default: CURRENT_TIMESTAMP does this column get updated to the current timestamp if I update the valu

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-30 23:24

    I think you have to define the timestamp column like this

    CREATE TABLE t1 
    (
        ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
    );
    

    See here

提交回复
热议问题