0
我不斷收到1064錯誤,當我運行下面的查詢,但我不明白什麼是錯的:2個外鍵創建表時MySQL的語法錯誤主鍵
CREATE TABLE hashmkb_mangatracker.group_release
(
group_id int NOT NULL,
release_id int NOT NULL,
PRIMARY KEY (group_id, release_id),
UNIQUE INDEX (release_id, group_id),
FOREIGN KEY (group_id) REFERENCES group(id),
FOREIGN KEY (release_id) REFERENCES release(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 'group(id),
FOREIGN KEY (release_id) REFERENCES release(id)
) ENGINE=INNODB' at line 7
感謝幫助。
'group'是一個保留字,你需要反引號''它。 –
就是這樣。可以相信這很簡單。謝謝。 – hash004