表创建时出现MYSQL错误

时间:2013-11-25 00:19:38

标签: mysql

我收到以下代码的错误:

create table JOB_TBL(
JT_JOB_ID_FLD INT AUTO_INCREMENT,
JT_JOB_DESCRIPTION_FLD VARCHAR(4000),
JT_JOB_POSTER_FLD INT NOT NULL,
JT_JOB_POST_DATE_FLD DATE NOT NULL,
JT_JOB_CLOSE_DATE_FLD DATE NOT NULL,
PRIMARY KEY (JT_JOB_ID_FLD),
FOREIGN KEY (JT_JOB_POSTER_FLD)
REFERENCES USER_TBL(UT_USER_ID_FLD)
) ENGINE = INNODB;

起初我以为它与两个日期字段中的NOT NULL有关,但是当我运行没有那些非空值的语句时它仍然会出错。这是我收到的错误:

#1064 - 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 'FLD INT NOT NULL,
JT_JOB_POST_DATE_FLD DATE NOT NULL,
JT_JOB_CLOSE_DATE_FLD DA' at line 4 

2 个答案:

答案 0 :(得分:2)

JT_JOB_POSTER_ FLD INT NOT NULL,
              ^----- what's this?

Mysql明确指出你到了错误的地方,下次只需屏住呼吸并仔细阅读。

答案 1 :(得分:2)

此行中的下划线之间不应有空格:

JT_JOB_POSTER_ FLD INT NOT NULL,
             ^^^