Question

I'm building a game system and I'm designing a database for this which keeps track of the games that players have played. Here are the entities in my system:

1.Players 2.Groups 3.Games

Each player can belong to multiple groups and a group will have multiple players in it.

Games will be played in the context of group by the players in that group. So each game will have a group that it is being played in and the players who are involved in that game.

In addition to players personal stats, each player will have stats specific in the context of their group. What tables do I need for this system.?

Here is what I have thought of so far, I will have a players table. Each player with a unique id and rest of his information, along with his stats combined across all of his groups. There will be a group table, with group id, group name and other information about group.

I don't know how to represent players to group relationship. Also I'm not clear on how the game table would look like. I'd assume each game has a unique id, players playing it and the group id in which that game belongs to.

Was it helpful?

Solution

yes you need relation or associative tables...

something like

player_group
---------------
player_id
group_id

game_player
-------------
player_id
game_id

in the game table:

game
----------
game_id
group_id
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top