简体   繁体   中英

MySQL syntax error, can't figure out what's wrong

Hello and thanks for reading my question! I am receiving a syntax error with this code but I cannot figure out what's wrong. Any insight is greatly appreciated.

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

I can't find any missing commas, and the event table definitely exists with an id column. Any ideas what I'm missing? Thank you!

Match is a reserved word . Enclose it in backticks:

create table `match` ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM