01
2007
Bowling data
I'm working on creating a MySQL database to keep track of bowling statistics. I'm having trouble planning exactly how to set up my tables because there are so many variables in bowling. Here's what I've come up with so far:
Table: GAME game_id player_id date location
Each bowling game has one player who plays on a certain date in a certain place. Not so bad so far. Each game is made up of 10 frames:
Table: FRAME frame_id // unique key game_id // each frame belongs to a specific game frame_no // identify which frame it is, 1-10 score_this // the score of this individual frame (max=10) score_thru // the score of the game up to and including this frame
Now we can start analyzing the stats. We can find a player's average score by finding all the games played by Player A, then selecting score_thru for frame_no=10 and averaging the results.
For more sophisticated analysis, it would be nice to know the results of each roll in a game. A frame can have 1, 2 or 3 rolls. The minimum number of rolls per game is 12 (perfect 300 score). The maximum number of rolls is 21.
Table: BALL ball_no // order of ball within frame (could be 1, 2 or 3) frame_id // each ball only belongs to one frame pins // number of pins knocked down strike // was ball a strike? split // was ball a split?
Now we can ask more sophisticated questions. With some complex queries we could determine how many times Player B converts two strikes into a turkey. Or how often any player picks up a split.

Fig. 1: Abridged version of the entity relationship diagram
I feel like I'm on the right track. I'm posting for two reasons: 1) typing it out and explaining is helping me better understand it, and 2) I'm hoping that people who are smarter than me may come across it and point out any problems.
Update, Dec. 2: View the full ERD (73k JPG)
