[thelist] SQL join tables

Les Lytollis les.lytollis at morse.com
Fri Jun 29 11:30:15 CDT 2001


Hi,

I have taken ownership of a small internal project to provide a sort of
developers' knowledge base. This allows our staff to post articles or code
snippets under a number of different subjects.

A number of the tables in the database have join tables to eliminate
many-to-many relationships. The problem is that I have always given those
join tables their own ID field to provide a primary key for the table. The
tables in the current database use the two foreign keys to provide a
"composite primary key". Is there any benefit to adding the ID field? I have
a feeling that the composite key will cause problems.

An example -  if articles can belong to many subjects:

Article (ArticleID(PK),  title, body, author)
Subject (SubjectID(PK), description)
article_subject(articleID(FK), subjectID(FK))
 - I would add an article_subjectID to this table


TIA
Lez


 




More information about the thelist mailing list