table relationships fo basketball league database

G

Guest

Hi, all,

I am creating a db for a school basketball league. I want to track team
stats per game, students stats per game, and games played.

I have the following tables, primary and foreign keys:
students-
pk: studentID fk: teams

studentGameStats (student stats per game)-
pks: studentID/GameID

gameDetails (game date, time, place)-
pk:Game ID

teams-
pk: teamID

teamGameStats(teams stats per game)-
pks: teamID/GameID

I have the game ID which can keep track of the student stats per game in one
table and the team stats in another table but I'm trying to relate the
student stats table and the team stats table so that I can show a team and
the players on the team for any particular game. I'm having a problem
relating these tables because they create a many to many relationship. How
can I resolve this issue and what would be the primary key(s).

Thanks for reading. Any suggestions would be appreciated.
AEA
 
D

Douglas J. Steele

Based on your description, I don't actually see a many-to-many relationship
between studentGameStats and teamGameStats, unless you're worried about
players changing teams during the seaon (but that would be handled as a
many-to-many between studetns and teams)

To be honest, I don't see the need for teamGameStats at all: shouldn't you
be able to derive it by summing the stats for each player on the team?

In any case, many-to-many relationships are resolved by introducing an
intersection entity that has the PKs of the two related tables. Take a look
at the Northwind database that comes with Access. The relationship between
Products and Orders is a many-to-many (a product can exist on many orders,
and an order can contain many products). The intersection entity there is
the Order Details table. For an example of how to handle updates, see the
Orders and Orders Subform forms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top