我一直在mysql中得到这个错误

时间:2014-11-05 10:57:28

标签: mysql

我为nfl团队创建了一个数据库。我创建了一个名为player的表,其中包含bios信息。现在我想创建一个名为交易的表格,该表格显示交易交易,但玩家根据玩家的主键显示活跃的名单。但我不断收到此错误:ERROR 1064 (42000): 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 'KEY(idplayer) REFERENCES players(playersid))' at line 8. `

create table transactions(
 transid INT UNSIGNED NOT NULL AUTO_INCREMENT,
 type VARCHAR(30),
 fromteam VARCHAR(30),
 toteam VARCHAR(30),
 idplayer INT UNSIGNED NOT NULL,
 PRIMARY KEY(transid),
 FORIEGN KEY(idplayer) REFERENCES players(playersid));

请有人帮我解决类似的经历。

2 个答案:

答案 0 :(得分:1)

我想你刚拼错外国人: - )

答案 1 :(得分:0)

错字,改变

        FORIEGN KEY(idplayer) REFERENCES players(playersid));

        FOREIGN KEY(idplayer) REFERENCES players(playersid));