MySQL语法错误 - ERROR 1064因为关闭括号

时间:2016-12-10 10:18:41

标签: mysql

我正在尝试创建一个mysql表,并收到以下错误:

您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以便在第19行的')'附近使用正确的语法

这是创建表脚本:

CREATE TABLE User(
userID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (userID),
username char(30) NOT NULL UNIQUE,
lastName char(30) NOT NULL,
firstName char(30) NOT NULL,
birthDay int NOT NULL CHECK(birthDay BETWEEN 1 AND 31),
birthMonth int NOT NULL CHECK(birthMonth BETWEEN 1 AND 13),
birthYear int NOT NULL CHECK(birthYear > 1900),
password char(30) NOT NULL,
geschlecht char(30) NOT NULL,
profilPicURL char(255) NOT NULL,
CONSTRAINT fk_lives_in
FOREIGN KEY (lives_in)
REFERENCES  Location(LocationID),
CONSTRAINT fk_comes_from
FOREIGN KEY (comes_from)
REFERENCES  Location(LocationID),
);

我感谢任何帮助, 谢谢!

1 个答案:

答案 0 :(得分:0)

CREATE TABLE User(
userID int NOT NULL AUTO_INCREMENT Primary Key,
username char(30) NOT NULL UNIQUE,
lastName char(30) NOT NULL,
firstName char(30) NOT NULL,
birthDay int NOT NULL CHECK(birthDay BETWEEN 1 AND 31),
birthMonth int NOT NULL CHECK(birthMonth BETWEEN 1 AND 13),
birthYear int NOT NULL CHECK(birthYear > 1900),
password char(30) NOT NULL,
geschlecht char(30) NOT NULL,
profilPicURL char(255) NOT NULL,
CONSTRAINT fk_lives_in
FOREIGN KEY (lives_in)
REFERENCES  Location(LocationID),
CONSTRAINT fk_comes_from
FOREIGN KEY (comes_from)
REFERENCES  Location(LocationID)
);

立即尝试