错误 1064 (42000):第 1 行 'Match( match_id INT(30) NOT NULL, club1_id CHAR(5), club1_score_id INT(30), club' 附近的错误

ERROR 1064 (42000): Error near 'Match( match_id INT(30) NOT NULL, club1_id CHAR(5), club1_score_id INT(30), club' at line 1

不断收到此错误:

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( match_id INT(30) NOT NULL, club1_id CHAR(5), club1_score_id INT(30), club' at line 1

尝试使用一些外键创建此 table:

CREATE TABLE Match(
    match_id INT(30) NOT NULL,
    club1_id CHAR(5),
    club1_score_id INT(30),
    club2_id CHAR(5),
    club2_score_id INT(30),
    start_time TIME,
    end_time TIME,
    day INT(2),
    event_id INT(30),
    Primary Key(match_id),
    Foreign Key(club1_id) REFERENCES Club(club_id),
    Foreign Key(club2_id) REFERENCES Club(club_id),
    Foreign Key(club1_score_id) REFERENCES Score(score_id),
    Foreign Key(club2_score_id) REFERENCES Score(score_id),
    Foreign Key(event_id) REFERENCES Event(event_id));

虽然看不出有什么问题。有帮助吗?

这是数据库设计。也不介意对此提出一些反馈。

Database Design

Match 是保留字。我建议将其更改为 Matches 这样您在使用它时就不必引用它了。我通常用复数命名我的表,因为它们包含多个实体,复数不太可能与保留字冲突。

保留字列表为here