0

I was going through the following data modeling exercise found here:

A Twitch streamer can host any number of tournaments for his community. Each tournament consists of a maximum of 20 teams. A team in turn consists of a maximum of three players, one of whom is the team leader. Each tournament has any number of rounds. A community moderator manually sets the status of the tournament to started, checked and completed. Each team can achieve a certain number of points in a round. These are made up of the placement and the number of kills.

The solution provided in the link is:

enter image description here

Can anyone explain why tourney_id and team_id are attributes of a participant? Given the requirements I feel like they should be attributes of the 'round' entity.

1 Answer 1

0

Can anyone explain why tourney_id and team_id are attributes of a participant? Given the requirements I feel like they should be attributes of the 'round' entity.

tourney_id is an attribute of the round table already, which makes sense because every round belongs to a single specific tourney, making it have a direct relationship.

team_id does not make sense on the round table because every team implicitly partakes in every round. This is known because a team belongs to a single specific tourney, and every round belongs to a single specific tourney, so that means for a given tourney all teams that relate to it, indirectly also relate to all rounds of that tourney. So there's no need to relate team directly to round and it wouldn't make sense anyway because there are multiple teams that partake in the same round of the same tourney, so you wouldn't be able to store multiple team_ids on a single round entity.

The relationship between participant and team is similar to the relationship between round and tourney in the sense that every participant belongs to a single team. So it makes sense to store the team_id in the participants table.

The tourney_id is a little redundant on the participants table, because there's an indirect relationship already between participants and tourney through the teams table. But there's nothing wrong with doing that. It allows someone to directly query for all of the participants of a given tourney (when they don't care about any information from the teams).

2
  • 1
    Thank you for the detailed explanation
    – sotn
    Commented Aug 18, 2022 at 2:09
  • @sotn Sure thing, no problem!
    – J.D.
    Commented Aug 18, 2022 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.