Mysql创建create_time跟update_time字段,使其自动存值。

创建语句如下:

ALTER TABLE table_name
ADD COLUMN create_time timestamp NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN update_time timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER create_time;

猜你喜欢

转载自blog.csdn.net/weixin_42688747/article/details/81386181