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
答案 0 :(得分:1)
您忘记在参考
之后添加表格名称CREATE TABLE module ( title VARCHAR(255), course_code INT(255), lecturer VARCHAR(255), PRIMARY KEY(course_code), FOREIGN KEY(lecturer) REFERENCES table(name) );