If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > New Members & Introductions > intersection tables question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-08-11, 14:49
ofilha ofilha is offline
Registered User
 
Join Date: Sep 2008
Posts: 7
intersection tables question

I searched this forum for ideas but could not find an answer. Here is the problem i am dealing with.

I have three tables: case,address and name. case and address have a many to many relationship and so does name and address. I created two intersection tables: case_name with composite: caseid,nameid and address_name with composite nameid,addressid.

What i am wondering now is, what about instead of creating two intersection tables, i just create one intersection table with three composite keys: a case_name_address table with a caseid, a nameid and an addressid as a composite. Are there any advantages or disadvantages to using a three key composite primary key?

Thank you.
Reply With Quote
  #2 (permalink)  
Old 07-08-11, 19:05
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,538
Quote:
Originally Posted by ofilha View Post
Are there any advantages or disadvantages to using a three key composite primary key?
the advantages are, if you only have one relationship, in which all three ids have to be present, then this 3-key design nicely accommodates that

the disadvantages are, if you can have a relationship between case and address, without regard to the name involved, or a relationship between name and address, without a case being involved, then this 3-key design is rubbish for supporting those

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 07-08-11, 19:37
ofilha ofilha is offline
Registered User
 
Join Date: Sep 2008
Posts: 7
intersection tables

Thank you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On