您好,感谢您阅读我的问题!我收到此代码的语法错误,但我无法弄清楚出了什么问题。非常感谢任何见解。
mysql> create table match (
-> event_id int not null,
-> player1_id int,
-> player2_id int,
-> player1_score int,
-> player2_score int,
-> winner_id int,
-> foreign key (event_id) references event(id)
-> );
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 'match (
event_id int not null,
player1_id int,
player2_id int,
player1_score int' at line 1
我找不到任何缺少的逗号,并且事件表肯定存在带有 id 列的情况。我有什么想法吗?谢谢!
最佳答案
匹配是 reserved word 。将其括在反引号中:
create table `match` ...
关于MySQL语法错误,无法找出问题所在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43487582/