运行以下create table时出错:
CREATE TABLE Event (
id VARCHAR(10) NOT NULL,
title VARCHAR(100),
start_date DATE NOT NULL,
end_date DATE,
description TEXT,
url VARCHAR(200),
website VARCHAR(200),
location VARCHAR(32) NOT NULL;
PRIMARY KEY (id),
FOREIGN KEY (location) REFERENCES Location(id)
);
我得到的错误是:
#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 '' at line 9
我知道这个错误与语法和运行的mysql版本不兼容有关,但是我已经检查了每一行,并且语法是正确的。我错过了什么吗?
提前感谢您的所有答案。
答案 0 :(得分:3)
尝试在线更改分号:
location VARCHAR(32) NOT NULL;
逗号。