我有一个 .mwb 文件,我想转发给工程师。它包含创建新表的查询,该表又创建一个 DATETIME 类型的列。
此查询中抛出错误的部分是:
'last_send_at` DATETIME NULL DEFAULT '0000-00-00 00:00:00',
错误是:
Executing SQL script in server
ERROR: Error 1067: Invalid default value for 'last_send_at'
怎么了?
最佳答案
DATETIME
字段必须保留 null
默认值,或者根本没有默认值。
For date and time types other than TIMESTAMP, the default is the appropriate “zero” value for the type. For the first TIMESTAMP column in a table, the default value is the current date and time.
关于mysql - DATETIME 字段的默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30099737/