Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relationship Design

Status
Not open for further replies.

robmkimmons

Technical User
Jun 29, 2001
51
0
0
US
In creating a glossary I have tblTerm. A term might have one or more aliases that are also terms within the same table.

For example:

Term X = Aliases Y & Z
Term Y = Aliases X & Z
Term Z = Aliases X & Y
Term A = No Alias
Term B = Alias C
Term C = Alias B

My current table structure:

tblTerm
TermID (autonum)
TermName (txt)

I am confused as to how i should proceed. Should I create a relationship between tblTerm and itself? ..if so, how? Or should I create a tblAlias?

Thanks!

~Rob

If we expect the unexpected, does that make the unexpected... well, expected?
 
You have a many-to-many relation, so you need a junction (aka bridge) table, eg:
tblAlias
TermID (Long, ForeignKey referencing tblTerm)
AliasID (Long, ForeignKey referencing tblTerm)
PrimaryKey(TermID,AliasID)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you for your response.

So that I understand correctly, tblAlias will only actually have TWO fields, each a foreign key and combined together making a composite key for that table?

Also, tblAlias.AliasID will reference tblTerm.TermID?

Thanks for your help!

~Rob

If we expect the unexpected, does that make the unexpected... well, expected?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top