Reputation: 575
I'm designing my first big database and want to check, whether I'm OK in providing tables relationships.
I'm designing a webapp where
users
can play games
in teams
game
has it's categories
users
create their team
for the game
and choose their team
category
game
has it's own subset of categories
enabledcategories
slightly differ from game to game. For example, there are slowpoke categories in game1 and game2, but they differ in alowed time.How do I hope to store this:
users
, teams
, games
,
categories
, each with it's adequate data fields and INT primary_key
suser
-team
M-N relationship tablegame
-category
M-N relationship table, with alowed time columncategory_id
and game_id
foreign key columns at team
tableMy common queries:
My suggestions to me:
category
-game
relation table and use it in team tablegame_id
in teams
table as INDEXThe question is if this thing is OK and what suggestions to accept?
Upvotes: 1
Views: 127
Reputation: 16362
Some thoughts:
UNSIGNED INT
for primary keys rather than INT
.Given that, it seems like you can easily process your "common queries".
What problems were your "suggestions" trying to solve?
Upvotes: 2