Having both a Created and Last Updated timestamp columns in MySQL 4.0

前端 未结 11 2192
逝去的感伤
逝去的感伤 2020-11-27 09:19

I have the following table schema;

CREATE TABLE `db1`.`sms_queue` (
  `Id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `Message` VARCHAR(160) NOT NULL DEFAUL         


        
11条回答
  •  萌比男神i
    2020-11-27 10:18

    You can have them both, just take off the "CURRENT_TIMESTAMP" flag on the created field. Whenever you create a new record in the table, just use "NOW()" for a value.

    Or.

    On the contrary, remove the 'ON UPDATE CURRENT_TIMESTAMP' flag and send the NOW() for that field. That way actually makes more sense.

提交回复
热议问题