What are appropriate ways to represent relationships between people in a database table?
Posted
by Emilio
on Stack Overflow
See other posts from Stack Overflow
or by Emilio
Published on 2010-05-01T18:47:04Z
Indexed on
2010/05/01
18:57 UTC
Read the original article
Hit count: 370
I've got a table of people - an ID primary key and a name. In my application, people can have 0 or more real-world relationships with other people, so Jack might "work for" Jane and Tom might "replace" Tony and Bob might "be an employee of" Rob and Bob might also "be married to" Mary.
What's the best way to represent this in the database? A many to many intersect table? A series of self joins? A relationship table with one row per relationship pair and type, where I insert records for the relationship in both directions?
© Stack Overflow or respective owner