我试图设计一个数据库,和我的一个表是这样的:我可以在这个外键中避免“冗余”吗?
表player_in_tournament:
ID_tourn | ID_player | and other attributes...
和PK由两个第一列。
在表tournament_game
(表示比赛的比赛/比赛)中,我想引用player_in_tournament中的2个“对象”,所以我应该有两个外键,每个都由ID_player和ID_tour。
但是ID_tour
在两个“对象”中都是相同的。
问题是改变第一个表的PK并添加ID_player_in_tournament
是一个好主意,并在tournament_game
表中使用它作为外键。
请编辑您的问题并提供样本数据,以便我们可以看到您想表示的内容。 –