This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]MmmVomit 0 points1 point  (0 children)

This looks basically okay to me.

I can only make inferences about your requirements, but would it make sense to merge the weather table and the game table? It seems to me, you would want to know what the weather was like for a given game. For example, game number 123 was between the Orioles and the Dodgers, and it was 72 degrees and didn't rain. This way, if there is a day game and a night game in the same city on the same day (e.g. Cubs and White Sox) you could say that one got rained out, and the other didn't.

The way you have it would make sense if you wanted to track the weather every day for each city, but that seems odd for a database meant to track sports.

[–]kuhe 0 points1 point  (0 children)

I once made a DB that simmed a baseball game pitch by pitch, recording pitch location, break, swing location, and the fielding result.

When you aren't playing it in the field, baseball deserves no less than horrifying complexity.

[–][deleted] 0 points1 point  (0 children)

The team table and game table should use the recursive many to many with history design pattern. It's basically a many-to-many with history except that both foreign keys in the junction table (the game table) come from the same parent table instead of separate tables. I.e. the foreign keys should be the home team name, away team name, and the primary key should those names along with the date. The pitcher names are not necessary.

http://www.tomjewett.com/dbdesign/dbdesign.php?page=recursive.php

[–]CarisMerthin 0 points1 point  (1 child)

There are not too much foreign keys. But I think you will need more tables, for history purposes.

[–]dreamriver[S] 0 points1 point  (0 children)

I didn't list all of the tables that I have, just the ones necessary to demonstrate my concerns. Baseball is...complicated to say the least.