mysql 創建字段時間和修改字段時間
mysql 修改創建時間和修改時間字段
創建時間:alter table tablename modify updateTime timestamp no null default current_timestamp;
修改時間:alter table tablename modify updateTime timestamp no null default current_timestamp on update current_timestamp;
備註:
default current_timestamp 表示當插入數據的時候,該字段默認值爲當前時間
on update current_timestamp 表示每次更新這條數據的時候,該字段都會更新成當前時間
用Navicat修改時間字段的時候,先把字段屬性改成datetime類型,然後再用sql語句修改,否則修改不成功(個人遇到的坑)