我在 Amazon Web Service (AWS) 关系数据库服务 (RDS) 中有一个表,表列为“Memory”、“Cores”、“Speed”和“Insert_Timestamp”,我正在尝试将数据库设置为每次将新行添加到此表时都会记录下来。话虽如此,我正在运行以下代码Alter table Instace_Types ALTER COLUMN Insert_Timestamp SET DEFAULT CURRENT_TIMESTAMP
。我遇到了这个错误:
"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 'COLUMN Insert_Timestamp SET DEFAULT CURRENT_TIMESTAMP' at line 1"
任何意见都将不胜感激。
最佳答案
第二个ALTER
应该是CHANGE
。
Alter table Instance_Types
CHANGE Insert_Timestamp
Insert_Timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
关于MySQL 时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24149633/