我正在尝试创建一个数据库,我已经编写了代码,当我将它导入到 phpMyAdmin 时,我收到以下错误:
#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 'OPTION(OPTION_ID)
)' at line 7
和我写的代码:
CREATE DATABASE MAWARID;
USE MAWARID;
CREATE TABLE TOPIC (
TOPIC_ID INT NOT NULL AUTO_INCREMENT,
TOPIC_NAME VARCHAR(30) NOT NULL,
PRIMARY KEY (TOPIC_ID)
);
CREATE TABLE QUESTION (
QUESTION_ID INT NOT NULL AUTO_INCREMENT,
QUESTION_NAME VARCHAR(100) NOT NULL,
ANSWER INT NOT NULL,
PRIMARY KEY (QUESTION_ID),
FOREIGN KEY (ANSWER) REFERENCES OPTION(OPTION_ID)
);
CREATE TABLE OPTION (
OPTION_ID INT NOT NULL AUTO_INCREMENT,
OPTION_NAME VARCHAR(100) NOT NULL,
QUESTION INT NOT NULL,
PRIMARY KEY (OPTION_ID),
FOREIGN KEY (QUESTION) REFERENCES QUESTION(QUESTION_ID)
);
我在这里检查了其他错误 #1064 问题,但似乎没有帮助我。
关于我为什么会收到此错误的任何想法?