MySQL查询中的错误1064

时间:2015-07-24 10:12:21

标签: mysql

CREATE TABLE IF NOT EXISTS references(
id INTEGER NOT NULL AUTO_INCREMENT,
title VARCHAR(25),
name VARCHAR(25),
profession VARCHAR(25),
address VARCHAR(25),
city VARCHAR(25),
state VARCHAR(25),
country VARCHAR(25),
mobileNumber VARCHAR(25),
emailAddress VARCHAR(25),
referenceType VARCHAR(25),
applicant_id INTEGER,
PRIMARY KEY(id)
);

错误:

SQL State  : 42000
Error Code : 1064
Message    : 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 'references(
id INTEGER NOT NULL AUTO_INCREMENT,
title VARCHAR(25),
name VA' at line 1  

我不知道错误意味着名称VA',查询名称为VARCHAR(25)

1 个答案:

答案 0 :(得分:0)

您可以使用这些。这里引用的是mysql的关键字。

CREATE TABLE IF NOT EXISTS `references`(
    id INTEGER NOT NULL AUTO_INCREMENT,
    title VARCHAR(25),
    name VARCHAR(25),
    profession VARCHAR(25),
    address VARCHAR(25),
    city VARCHAR(25),
    state VARCHAR(25),
    country VARCHAR(25),
    mobileNumber VARCHAR(25),
    emailAddress VARCHAR(25),
    referenceType VARCHAR(25),
    applicant_id INTEGER,
    PRIMARY KEY(id)
    );

谢谢。