我尝试过
alter table t_granja ALTER COLUMN purchase_date TIMESTAMP DEFAULT now();
但我遇到了错误
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TIMESTAMP DEFAULT now()' at line 1
答案 0 :(得分:0)
使用CURRENT_TIMESTAMP
ALTER TABLE t_granja
ALTER COLUMN purchase_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP;