MySQL建表语句执行出现错误:错误码: 1067 / 错误码: 1146

软件:SQLyog 企业版

建表语句如下:

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2015/12/17 16:44:15                          */
/*==============================================================*/


DROP INDEX Eemm_Group_Class_Mapping_1 ON Eemm_Group_Class_Mapping;

DROP TABLE IF EXISTS Eemm_Group_Class_Mapping;

/*==============================================================*/
/* Table: Eemm_Group_Class_Mapping                              */
/*==============================================================*/
CREATE TABLE Eemm_Group_Class_Mapping
(
   Evaluation_Id         BIGINT,
   Group_Id              BIGINT,
   Class_Id              BIGINT,
   Created_At            DATETIME NOT NULL DEFAULT 'SYSDATE',
   Increment_Id 	BIGINT PRIMARY KEY AUTO_INCREMENT,
   As_Of_Date           BIGINT NOT NULL,
   As_Of_Hour           BIGINT NOT NULL
);

/*==============================================================*/
/* Index: Eemm_Group_Class_Mapping_1                            */
/*==============================================================*/
CREATE UNIQUE INDEX Eemm_Group_Class_Mapping_1 ON Eemm_Group_Class_Mapping
(
   Evaluation_Id,
   Group_Id,
   Class_Id
);
错误日志如下:

Total Time     : 00:00:00:000


(0 row(s) affected, 1 warning(s))
Execution Time : 00:00:00:063
Transfer Time  : 00:00:01:092
Total Time     : 00:00:01:155


错误码: 1067
Invalid default value for 'Created_At'


Execution Time : 00:00:00:000
Transfer Time  : 00:00:00:000
Total Time     : 00:00:00:000


错误码: 1146
Table 'test.Eemm_Group_Class_Mapping' doesn't exist


Execution Time : 00:00:00:000
Transfer Time  : 00:00:00:000
Total Time     : 00:00:00:000


解决办法:

发现错误发生在 'Created_At'这一行,删除DEFAULT 'SYSDATE',再次执行,成功!


你可能感兴趣的:(MySQL建表语句执行出现错误:错误码: 1067 / 错误码: 1146)