What is the use of self-referencing tables ?
I came across the concept lately and I cannot find any simple example of it (every links on Google explain how to use it with many frameworks).
database-design
What is the use of self-referencing tables ?
I came across the concept lately and I cannot find any simple example of it (every links on Google explain how to use it with many frameworks).
Best Answer
Self referencing tables can be used to store hierarchical data. For example, see my answer to this question.
You can also use self referencing tables to record non-hierarchical relationships which are one-to-one. For example, let's say you have a
PERSON
table and you want to have a relationship is currently married to. You might model this with an intersection table, or you might use a simpler self referencing relationship.