View Single Post
  #2  
Old May 13th, 2004, 06:12 AM
TC
external usenet poster
 
Posts: n/a
Default Multiple Many-To-Many Tables


"Tom" wrote in message
...
Hello,

I am familiar with using a junction table for a "many-to-many"

relationship.

However, I'm not exactly sure how I could string multiple "many-to-many"

or
junction tables into an architecture.

Does anyone have a suggestion?


Here are two examples.

1. If A is many-to-many (m:m) with B, you need a junction table AB (or
whatever) - as you know. Similarly, if some other table C is m:m to D, you
need another junction table CD. Ditto for as many other tables & junction
pairs that are required.

2. Say you have Person, Club, and PersonClub. (The latter is the junction
table to allow a person to belong to many clubs, and a club to have many
persons.) Say you need to record each consecutive period that a person was a
member of each club. (Eg. 1990-1993, 1998-2001 etc). In this case, for each
one entry in the PersonClub table, there are many entries in a table of
date-ranges:

tblPersonClub
PersonID ( composite )
ClubID ( primary key )

DateRange
PersonID ( composite )
ClubID ( primary )
DateFrom ( key )
DateTo

In the latter example:

- Person : Club is m:m ) the normal
- Person : PersonClub is 1:m ) junction table
- Club : PersonClub is 1:m ) structure

- PersonClub : DateRange is 1:m

Do those help?


For instance, I may have members that are assigned to many projects (and
each project many members). But I also have boards that have multiple
priorities and multiple priorities are linked to multiple organizations.

Currently, I'm myself trying to figure out the relationships between all

the
entities. Again, knowing how I could use (with a generic example)

multiple
junction tables would be great advice.

Thanks,
Tom