Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am trying to create a database to store details relating to darts matches. Im relatively new to this so was wondering if the design I've come up with below would work. It seems I have lots of places referencing the Player table, is this necesary?

share|improve this question
    
I don't get the connection from Leg, Set, Match to Player... The image shows a relation but there is not column for it in the join table? Or is this just a weird way of illustrating that? –  DrColossos Jul 24 '11 at 12:59
    
They all have a "Winning_Player_ID" which has a foreign key referencing Player_ID in the Player table –  Omiron Jul 24 '11 at 15:18
    
You might want to look at this question: dba.stackexchange.com/q/1206/247 –  Eric Humphrey - lotsahelp Aug 16 '11 at 21:39

1 Answer 1

I would look at it in what the most common queries are going to be for the database. That way I don't have to do alot of joins to get my results.

Something like this just playing with it:
Player: PlayerID (PK), Forename, Surname, Nickname
Matches: MatchID (PK), PlayerID (FK), SetID (FK), MatchWinner (True/False)
Sets: SetID (PK), LegID, SetWinner (True/False), LegWinner (True/False)
Turn: TurnID (PK), LegID (FK), PlayerID (FK), Number, [Double], [Treble]

With my most common queries probably being Player information and how that player did each turn. Then query the matches and who was the winning player per match and then maybe results for each set.

Just my thoughts.

share|improve this answer
    
Why does Matches only have a single playerID? Shouldn't it have both playerIDs? –  a_horse_with_no_name Sep 23 '11 at 8:00
    
both playerIDs? –  Shawn Melton Sep 23 '11 at 13:09
    
a match is between two players, correct? So I would assume that the definition of a match in the database would include references to both players –  a_horse_with_no_name Sep 23 '11 at 13:17
    
@a_horse_with_no_name You would store n rows per match, each with the same MatchID and with a different PlayerID. PK should be MatchID AND PlayerID. Also Sets should have an FK of MatchID into Matches, at least assuming this is like tennis where sets belong to a match, I don't know about darts. –  Ben Brocka Sep 23 '11 at 13:29
    
@SirTapTap: but if this is a design for tournaments that always involve two players I don't see the need to make it "multi-player" aware by stored two rows for one match. But I guess that's personal preference. –  a_horse_with_no_name Sep 23 '11 at 13:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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