MySQL auto-store datetime for each row

后端 未结 7 487
醉话见心
醉话见心 2020-12-04 11:33

In MySQL, I\'m sick of adding the columns dt_created and dt_modified (which are date time stamps for creation and last modified respectively) to al

7条回答
  •  情歌与酒
    2020-12-04 11:47

    could be set as default an on update of rows

    ALTER TABLE `tablename` CHANGE `dt` `dt` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
    

提交回复
热议问题