1

I am designing a database based on NBA stats.

For a particular part, I have:

Game: [ Id, HomeTeam, AwayTeam, Date, GameTime … ]

GameScore: [ Id, GameId(FK), QuarterOne, QuarterTwo … ]

For game score, there is quarter one to quarter four. How should I design it it to include overtime quarters. What is best design method for this situation?

Should I put the values into one column?

Or should I have a separate table as follows:

Game: [ Id, HomeTeam, AwayTeam, Date, GameTime … ]

GameScore: [ Id, GameId(FK), QuarterOne, QuarterTwo … ]

OvertimeScore: [ GameScoreId(FK), Quarter, score ]

The method above, will include the overtime score in the table "OvertimeScore", where quarter column stores the quarter value, and score column stores the score value.

It doesn't seem right design for some reason. Please help thanks.

2 Answers 2

0

Do not have GameScore or OvertimeScore. Instead have QuarterScore keyed by GameID and Quarter. For normal games there will be four rows per game. For overtime there will be 5, 6, or however many are needed. Total score and a count of quarters can be summarised as a column in Game, if this is useful.

0

If you created an OverTimeScore table, you'd then need to add an INT or BIT field to GameScore or Game table to check if overtime exists or not. Are you also going to store the total score? Or just each quarter score and calculate the total in your app/query? If this were me, I would add a total score field and an overtime field into my GameScore table, I don't see a reason to break it out into its own table. Populate the field if there is overtime, otherwise leave it NULL. You can then just work your queries to check is null. 101 ways...

1
  • The thing is, if i added a overtime field in GameScore table then what if there is more than one overtime session's (e.g. some games, have one or two or more overtimes, and I would like to keep them distinct)
    – Tyler N
    Jul 21, 2016 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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