J
J
Jaguar_sea2017-01-23 02:38:47
Database design
Jaguar_sea, 2017-01-23 02:38:47

Is it possible to improve the structure of the database?

Help improve the structure of the database. The players organize a tournament with an equal but arbitrary number of teams. The tournament grid consists of rounds equal to the number of teams. In each round, the players play each other with the n-th team. Statistics are kept on players: number of games, points, etc. At the moment, the database looks like shown in the attached file, and I think this is not the best option. Help me please.
73efbe69ccd64917bc4a3efabf259b01.PNG
PS In the "CompetitionStatistics" table, instead of PlayerOne and PlayerTwo, OwnerPlayer and VisitorPlayer would probably be more clear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2017-01-23
@Jaguar_sea

Player:
   team = FK(Team)
   ...

Team:
   ...

Competition:
    ...

CompetitionTour:
   competition = FK(Competition)
   owner = FK(Team)
   visitor = FK(Team)
// правильнее (с точки зрения НФ), получать результат, 
// как сумму результатов игроков обеих комманд
// но если не напортачить с обработкой, то больших проблем быть не должно
   owner_result
   visitor_result


CompetitionTourPlayerStats:
   competition_tour = FK(CompetitionTour)
   player = FK(Player)
   result

M2M = https://en.wikipedia.org/wiki/Many-to-many_(data_model)
FK = https://en.wikipedia.org/wiki/Foreign_key

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question