【发布时间】:2018-05-21 18:48:05
【问题描述】:
子表的创建如下.....
create table match_detail (
match_id int primary key auto_increment,
team1_id int(5),
team2_id int(5),
foreign key (team1_id) references team(team_id),
foreign key(team2_id) references team(team_id)
);
父表数据如下......
create table team(
team_id int(5) primary key,
team_name varchar(20)
);
我想在子表(team1_id,team2_id)中创建两个外键,这两个字段引用另一个表(team_id,即团队表)中的相同主键列...
你能帮我解决这个问题吗?
【问题讨论】:
-
您正在为密钥(team2_id)引用团队(team1_id),我猜是复制粘贴问题
-
你能帮忙解决这个问题吗????
标签: database relational-database