我想創建一個具有多個外鍵的表,並且出現錯誤。我不確定我做錯了什麼,我一直在修補它。我敢肯定,它的東西小而笨,但幫助表示讚賞。MYSQL與多個外鍵創建表錯誤
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, 地址_」在行1
'ORDER'這是你指定了你的表名是保留關鍵字。這是一個保留關鍵字的完整列表:[MySQL保留關鍵字列表](http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html) –