Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to design a sports statistics database for multiple sports? [closed]

I'm trying to design a database to store player statistics for multiple types of sports.

In the database, you would have a bunch of players. Each player belongs to one team, and each team plays one sport. Here are the tables I have for just that part so far:

Player (Player_ID, Team_ID, FirstName, LastName)

Team (Team_ID, Sport_ID, TeamName)

Sport (Sport_ID, SportName)

Now I want to store the player's statistics. I run into a problem with different players playing different sports and therefore having to store different kinds of statistics for each sport. If I were storing hockey players and baseball players for example:

  • for the hockey players I want to store goals and assists

  • for the baseball players I want to store hits, home runs and RBIs.

Is there a proper way to do something like this using one database? Have I even started the right way?

like image 439
Curtis Avatar asked Dec 09 '10 23:12

Curtis


People also ask

How is SQL used in sports?

Sports teams collect data, a ton of it. In order to make this data readily accessible, they usually store it in large structured databases. Data scientists and analysts are able to pull this data by using Structured Query Language (SQL).

How are statistics applied in sports?

Sports analytics is the process of plugging statistics into mathematical models to predict the outcome of a given play or game. Coaches rely on analytics to scout opponents and optimize play calls in games, while front offices use it to prioritize player development.

What do stats perform do?

Stats Perform offers a comprehensive list of products and services designed to drive fan engagement, improve team performance and enhance fantasy and betting solutions.


2 Answers

The proper way is to make multiple tables, one for each sport seems likely.

Player (Player_ID, FirstName, LastName)
Team (Team_ID, Sport_ID, TeamName)
TeamList (Team_ID, Player_ID)
Sport (Sport_ID, SportName)
HockeyStats (Player_ID, Team_ID, Year, Goals, GamesPlayed, Assists)
BaseBallStats (Player_ID, Team_ID, Years, BoringSport)

This also resolves the situation with trading, which team the points were obtained from, as well as multiple sports.

like image 178
Jean-Bernard Pellerin Avatar answered Oct 13 '22 01:10

Jean-Bernard Pellerin


You can get inspiration from sportsdb, a rdbms schema for sports modeling created by XML Team. In that schema the game and players statistics are stored in denormalized tables, and the core stats (like score) are kept separated from the sports-specific ones. The schema is quite complex, but can give you an idea about a possible implementation

like image 20
mdoglio Avatar answered Oct 13 '22 01:10

mdoglio