Re: Lazy summer project: build a basketball app.

From: Kenneth Downs <knode.wants.this_at_see.sigblock>
Date: Sun, 02 Jul 2006 12:59:19 -0400
Message-Id: <lkaln3-f3s.ln1_at_pluto.downsfam.net>


I designed a database that does all of this, and runs on automatic feeds from ESPN. Most of it is simple. As you mentioned in your post, the only real tricky part is the games table.

First some simple stuff. The basic tables of divisions, conferences and teams are all pretty straightforward, as is the table of players. A table of venues is also in order if you want to keep track of such things.

As for the actual stats, if you are planning to record box scores then the fundamental table is the player-game box score table, where you store the stats for one player in one game. All stats can be derived from the raw data in this table, such as team-game, team-season, and team-all-time, as well as player-season, player-team, and player-all-time.

Now for games. You can get in trouble if you try to make this into a team-game table as well (such as seeking a symmetry for home/away teams). What worked for us was a games table that records things like venue, date, time, season (playoffs, all-star, regular) stuff like that, and a separate game-team table that records a team's participation in a game. FWIW, if you are keeping box scores at the player-game level then a game-team table is completely derivable, it can be a view. (Or if you do automation in the server, as I do, a system-controlled table).

ESPN uses an interesting key for games, which we deemed "Good Enough" and used ourselves, it is built from date, league, home team, and a double-header flag (the double-header flag is irrelevant in college hoops, but I include it for completeness). Particular game codes might look like this:

20060301NCAABCLEMSON---0
20060201NBA--LALAKERS--0
20051020NFL--PITTSBURGH0 ...there are two pieces of information you don't need in there, the league and the double-header flag, but it should get the idea across.

Hope this helps, have fun!

-- 
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth_at_(Sec)ure(Dat)a(.com)
Received on Sun Jul 02 2006 - 18:59:19 CEST

Original text of this message