I am creating a database based on a sports game to store matches and every player will be involved in every match. is. I am having trouble solving a lot of relationships. I currently have the following applause:
Player match player match There will always be at least two players in a match. What is the best design for this approach? I will advise you to stick to many people with many relationships, this will give you a lot of data model Not allowing complexity to easily change how many players' specifications in a game. Player Mail
ID name < / Code>
ID date
player_id match_id home_team goals_for goals_against
ID name
player map to
player Foreign key from code>
from player match
- A player has played in all the matches. Select from M * Play Player Player Join PIID = pm.player_id on PM at PM.m.id = pm.match_id where PID = / * Your Player ID * / - Select All Players in a Match P . * Match Mim to Player Map PM at MID = pm.match_id PID at POIP P.ID = pm.player_id WHERE m.id = / * Your Match ID * / - Player Information for a Match by PM * Player Join Player Map at p.id = pm.player_id Join m.id = pm.match_id on match mf WHERE p.id = / * Your Player ID * / and MID = / * Your Match ID * /
No comments:
Post a Comment