Is this SQL schema fit for storing sports data and statistics?

3.8k views Asked by At

enter image description here

I am planning on using this SQL schema to store/generate statistics and player data for various sports. I wanted to keep it as agnostic as possible, but given that each sport has different metrics for scoring and gameplay, I had to break it up at the end.

1

There are 1 answers

2
Bohemian On BEST ANSWER

There are two "red flags" in there:

Any time you name a table with the value of what should be a foreign key's value, you have almost certainly got a problem:

  • NBAGamePerformance
  • NCAABPerformance

These should be merged to GamePerformance and a foreign key added to League. If there's no such thing as an "assist" in NCAAB (the only difference between the tables), just make it null able.

You should fm do thus because:

  • the code behind these two table can be the shared
  • if you want to start supporting performance stats for another league, you can without changing your schema (rather than create yer another table)
  • you can query overall statistics, or compare statics between leagues easily (possible, but not realistic with split tables)

Remember:

  • adding rows is trivial compared to adding columns
  • adding columns is trivial compared to adding tables

Design your schema with these principles in mind and your system will be easier to build and maintain.