Ed wrote:> Hi all,
> I'm looking into making a tree structured db which will have several roots
> and many nodes so it needs to be efficient in querying records.
> I would also like it to be possible to trace origins. Here is a basic
> Frank Jane
> | |
> / \ / \
> John Jack Paula Maria
> | | |
> / \ / / \
> Ed Fred Orietta Marta Renata
> So if Frank is say (1,1) and Jane (1,2). Then John would be (2,1,1) and
> Maria (2,2,2). This is I guess, fine for a small structured tree but I
> doubt it will be managable on a large scale as tables will be increasingly
> complex and unmanagable.
> Can anyone give me a sollution to this problem? Is there some doentation
> I could read about this?
> I am using: mysql Ver 14.7 Distrib 4.1.20, for pc-linux-gnu (i686) using
> readline 5.1
> An upgrade is feasable if it can solve my problem.
> Many thanks to you all.
Don't worry about a physical position in the tree - in fact, it's a very bad
thing to worry about. What happens, for instance, if you now add someone above
Frank? You're whole tree needs to be reworked.
Rather, just keep track of the parent for each item. So Ed and Fred would have
John as a parent, and John would have Frank as a parent. At the top, Frank
would have no one for a parent.
Remove the "x" from my email address
JDS Computer Training Corp.