Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 14th, 2007, 12:41 PM
klazoid klazoid is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 2 klazoid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 25 sec
Reputation Power: 0
Arrow Problem with my db design

I would like to get your opinion on the following build of my db. Its made to contain statistics from sportsgames. The teamstats + individual stats have to be saved in it for every match. This is how it looks right now:

tblteams: teamID (general team data)
tblplayers: playerID - teamID (general player data)
tblmatches: matchID - teamID1 - teamID2 (team totals from the matches teamID1 vs teamID2)
tblstats: statsID - playerID - matchID (stats from one player on one specific match)

I'm having the following problem:
- Players change teams, this is not a big problem if you change the teamID of the player. The problem is that the players stats history becomes messed up. Then all his former stats will appear as if he played always for his new team. So if player x played in 2004 for team y then you have to see that on the 2004 statistics page even if he now plays for team z.

Because of that i thought to add a new field to tblplayers and this table would like like this:
tblplayers: playerID - teamID0405 - teamID0506 - teamID0607 - ...

This system looked good at first sight untill I was thinking that players can change teams within one season. Because of this teamID0506 could be teamx and change that same year too teamy. So the above doesnt work.

Is there someone with a better solution? If you see other problems arising feel free to tell me them. I rather work now on my db for some longer then have a big mess within 3 months.

One solution i thought about was making a table for every team every year like:
tblteamx0607: playerID
tblteamx0708: playerID
tblteamy0708: playerID

I don't know if this is a good solution and even from a db designers viewpoint 'legit'.

thx in advance for your help

Reply With Quote
  #2  
Old August 14th, 2007, 02:23 PM
klazoid klazoid is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 2 klazoid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 25 sec
Reputation Power: 0
I think I found a solution:

adding the field teamID to the tblstats makes it possible to know for what team the stats where made, tracking this togheter with a date makes it possible to know in what seasons that was done

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > Problem with my db design


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway