M
mscertified
A system I am developing will have as a key component a 3-level hierarchical
structure. I know this can be represented by 3 separate tables A, B, C where
rows in B are linked to A and rows in C are linked to B. However, I can also
represent this structure by a single table by having rows refer back to the
primary key of other rows, thus:
Key
Name
Parent Key (points to Key)
In this design the top level rows have no parent and the lowest level rows
have no other row pointing to them. This seems the most elegant solution and
has the advantage of supporting any number of levels in a single table.
However, I can forsee the queries to extract data being rather tricky.
Does anyone have any input on which representation would be best?
structure. I know this can be represented by 3 separate tables A, B, C where
rows in B are linked to A and rows in C are linked to B. However, I can also
represent this structure by a single table by having rows refer back to the
primary key of other rows, thus:
Key
Name
Parent Key (points to Key)
In this design the top level rows have no parent and the lowest level rows
have no other row pointing to them. This seems the most elegant solution and
has the advantage of supporting any number of levels in a single table.
However, I can forsee the queries to extract data being rather tricky.
Does anyone have any input on which representation would be best?