Design question: Years/Teams/Students


#1

People,

I want to design a historical sports db for my old school. I think at
the moment it should be like:

A year has many teams
A team has many students
A student has one lastname, firstname and middlename

but a student can also have many teams (eg summer/winter abd over a
number of years) . .

Is there a problem with this? Doesn’t it just mean that there will be a
student table with:

id
lastname
firstname
middlename

and a separate “studentteams” table with:

id
student_id
team_id

?

Thanks,

Phil.

Philip R.

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
Mobile: +61:(0)411-185-652
Fax: +61:(0)2-8221-9599
E-mail: removed_email_address@domain.invalid


#2

Hi Phil,

It seems to me that each of those set could have a many-to-many
relationship to both of the other sets - coding them just depends on
whether
people really care about what teams played in year xxxx or what years
Johnny
XXXX played in.

Check out this page for these “has and belongs to many” relationships:
http://wiki.rubyonrails.org/rails/pages/has_and_belongs_to_many