尝试将其实现到数据库中,其他所有类似工具到目前为止都已有效。
create table participation (
team_id int(11) not null,
driver_id int(11) not null,
race_id int(11) not null,
points_earned int(11),
constraint part_pk primary key (team_id, driver_id, race_id),
constraint part_fk foreign key (team_id) references team (team_id) ON update cascade,
constraint part_fktwo foreign key (driver_id) references driver (driver_id) ON update cascade,
constraint part_fkthree foreign key (race_id) references race (race_id) ON update cascade,
)
engine=innodb;
在最后一个括号处出错。
答案 0 :(得分:2)
在查询结尾处有一个额外的逗号(最后一个外键约束):
create table participation (
team_id int(11) not null,
driver_id int(11) not null,
race_id int(11) not null,
points_earned int(11),
constraint part_pk primary key (team_id, driver_id, race_id),
constraint part_fk foreign key (team_id) references team (team_id) ON update cascade,
constraint part_fktwo foreign key (driver_id) references driver (driver_id) ON update cascade,
constraint part_fkthree foreign key (race_id) references race (race_id) ON update cascade
)
engine=innodb;