Sports / Box Score Database design

Reply

Join Date: Oct 2008
Posts: 3
Reputation: jemagee is an unknown quantity at this point 
Solved Threads: 0
jemagee jemagee is offline Offline
Newbie Poster

Sports / Box Score Database design

 
0
  #1
Oct 15th, 2008
I'm trying to wrap my head around a database that will maintain 'box scores' for sporting events and be searchable on a various amount of fields including how a player performs home and away and in wins losses.

I can't figure out how to design the tables properly for the home/away win loss scenario in a way that normalizes. Any suggestions would be appreciated.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 306
Reputation: timothybard is an unknown quantity at this point 
Solved Threads: 26
timothybard's Avatar
timothybard timothybard is offline Offline
Posting Whiz

Re: Sports / Box Score Database design

 
0
  #2
Oct 15th, 2008
I'm not a sports person, so I'm not sure this will track everything you need it to track, but it should give you a start:

Location: ID, Location Name
Team: ID, Team Name, Home Location (location foreign key)
Player: ID, Team ID, Player Name
Game: ID, Location ID, Game Name
Stat Type: ID, Name of Stat (Runs, At Bat, RBI, etc)
Stat: ID, Game ID, Player ID, Stat value, Stat Type

Does that help?
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 3
Reputation: jemagee is an unknown quantity at this point 
Solved Threads: 0
jemagee jemagee is offline Offline
Newbie Poster

Re: Sports / Box Score Database design

 
0
  #3
Oct 18th, 2008
Unfortunately I don't think it does, it's the home away winner loser thing i want to make easier so that when i query the database i only have to query one field. I might have to make a separate table fore 'home/away' related to the 'games' table with a key relationiship on the UID for the game number.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 306
Reputation: timothybard is an unknown quantity at this point 
Solved Threads: 26
timothybard's Avatar
timothybard timothybard is offline Offline
Posting Whiz

Re: Sports / Box Score Database design

 
0
  #4
Oct 19th, 2008
I was thinking you could create a query that determines the home/away by joining the Stat table to the Game table, which has the Location Id. Then join the Stat table to the Player table and join Player table to the Team table, which has the Home Location Id. I would then compare the Home Location Id to the Location Id in the Game table to see if the stat is for a home game or an away game.

Of course, you can create a field in the game table that tracks if the game is home or away, but I wouldn't recommend it. The query would be easier to put together, but the database would not have proper normalization. Having said that, the method you mentioned would still work though.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Database Design Forum
Thread Tools Search this Thread



Tag cloud for Database Design
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC