0

长话短说,我需要为某种足球数据库建模。比赛由日期和参赛的两支球队确定。我有一个名为 Team 的强大实体,问题是我如何建模以便匹配实体(我怀疑它是一个弱实体)有两个依赖项?

4

2 回答 2

0

您的匹配实体将包含三个字段:日期、团队 1、团队 2。

匹配实体的主键类似于:primarykey(date, team1, team2)

Create table Match(
  date datetime not_null,
  team1 int not_null,
  team2 int not_null,
  primary_key(date, team1, team2),
  foreign key (team1) references Team(id),
  foreign key (team2) references Team(id)
)
于 2013-04-05T15:37:45.560 回答
0

好的,那么你想要的是这样的。问题是对此有不同的表示法。我希望这可以帮助你。

ER模型

于 2013-04-05T20:04:33.193 回答