每个赛季的篮球队

每个赛季的篮球队

本文介绍了每个赛季的篮球队/比赛/得分数据库.表结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为篮球赛季创建一个数据库.在这一点上,我保持简单,并存储表:

I am creating a database for a Basketball Season. At this point, I am keeping it simple, and storing tables:

-联赛 id[PK], name->(NBA、NCAAM 等)

-League id[PK], name->(NBA, NCAAM, etc)

-年份 id[PK], League_id[FK], year->(2012-2013, 2011-2012, etc)

-Year id[PK], league_id[FK], year->(2012-2013, 2011-2012, etc)

-球队 id[PK], League_id[FK], name->(公牛、湖人等)

-Team id[PK], league_id[FK], name->(Bulls, Lakers, Etc)

-游戏 id[PK]、home_team[FK]、away_team[FK]

-Game id[PK], home_team[FK], away_team[FK]

-得分 id[PK]、game_id[FK]、home_score、away_score

-Score id[PK], game_id[FK], home_score, away_score

我的问题是关于表结构的.我对 sql 有点陌生,但我希望能够根据数据库信息进行计算.例如:

My question is about table structure. I am somewhat new to sql, but I want to be able to make calcuations based on database info. For example:

A 队在客场,与 B 队比赛,其中 A 队的客场平均得分为 x,B 队的主场平均得分为 y...以此类推

Team A on the road, playing team B, where team A's road score avg is x and team B's home score average is y... and so on

你看到任何会尖叫的东西不要那样做吗?只是想让你们看一眼.

Anything you see that screams DONT DO IT THAT WAY? Just wanted you guys to take a quick look.

最终想开发一个类似这样的跨运动数据库:

Eventually would like to develop a cross sport DB similar to this:

http://www.bc.edu/content/dam/files/schools/cas_sites/cs/local/bach/2008/08LawrenceChang.pdf

但是想从这里开始获得一个基本的抓取算法,以及一些基本的统计数据.让我知道你的想法.非常感谢!

But want to start here to get a base scraping algorithm, and some basic stats to start out. Let me know whatcha think. Thanks a bunch!

推荐答案

乍一看,我会将分数放在游戏表中并添加一个游戏日期字段.我会将年份表重命名为季节,并包括开始和停止日期.还可以考虑在游戏表中添加一个季节 ID.

At first glance I would put the scores in the game table and add a game date field. I would rename the year table as season, and include start and stop dates. Also consider adding a season id to the game table.

这篇关于每个赛季的篮球队/比赛/得分数据库.表结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 22:22