我正在尝试创建一个具有多个外键的表,但出现错误。我不确定我做错了什么,我一直在修补它一段时间。我敢肯定它的东西小而愚蠢,但感谢您的帮助。
Create table Order(
order_number INT AUTO_INCREMENT,
product_id INT(11) NOT NULL,
address_id INT(11) NOT NULL,
user_id INT(11) NOT NULL,
quantity INT(3) NOT NULL,
size VARCHAR(20) NOT NULL,
status VARCHAR(20) NOT NULL,
order_date DATE NOT NULL,
PRIMARY KEY (order_number),
FOREIGN KEY (user_id)
REFERENCES User (user_id),
FOREIGN KEY (product_id)
REFERENCES Product (product_id),
FOREIGN KEY (address_id)
REFERENCES Address (address_id)
)ENGINE = INNODB
我得到的具体错误是:
#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 'Order(
order_number INT AUTO_INCREMENT,product_id INT(11) NOT NULL,address_' 在第 1 行