Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you normalize one-to-one-or-the-other relationships?

I'm storing data on baseball statistics and would like to do so with three tables: players, battingStats, and pitchingStats. For the purpose of the question, each player will have batting stats or pitching stats, but not both.

How would I normalize such a relationship in 3NF?

like image 745
Yes - that Jake. Avatar asked Mar 23 '10 13:03

Yes - that Jake.


1 Answers

PlayerId would be a foreign key in both BattingStats and PitchingStats tables

[and remember to put some time dimension (season, year, et al) in the stats tables]

and by the way, this is a bad assumption: as far as I know, pitchers are allowed to bat, too!

like image 199
Steven A. Lowe Avatar answered Sep 25 '22 17:09

Steven A. Lowe