Mysql 当我为外键运行此sql查询时出错
错误:Mysql 当我为外键运行此sql查询时出错,mysql,Mysql,错误: CREATE TABLE module ( title VARCHAR(255), course_code INT(255), lecturer VARCHAR(255), PRIMARY KEY(course_code), FOREIGN KEY(lecturer)REFERENCES(name) ); 您忘了在引用之后包含表名 ERROR 1064 (42000) at line 32: You have an error in your S
CREATE TABLE module
(
title VARCHAR(255),
course_code INT(255),
lecturer VARCHAR(255),
PRIMARY KEY(course_code),
FOREIGN KEY(lecturer)REFERENCES(name)
);
您忘了在引用之后包含表名
ERROR 1064 (42000) at line 32: 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 '(name)
)' at line 7
第32行是哪一行?在
外键
和引用
之间是否缺少逗号?
CREATE TABLE module ( title VARCHAR(255), course_code INT(255), lecturer VARCHAR(255), PRIMARY KEY(course_code), FOREIGN KEY(lecturer) REFERENCES table(name) );