Forum: Ruby on Rails Design question: Years/Teams/Students

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Philip R. (Guest)
on 2006-04-16 11:32
(Received via mailing list)
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
Daniel H. (Guest)
on 2006-04-16 12:21
(Received via mailing list)
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_be...
This topic is locked and can not be replied to.