Search code examples
normalizationdatabase-normalization3nfthird-normal-form

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?


Solution

  • 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!