The question I'm hearing is 'How do I store hierarchical data in a relational DB?' (of course I could be missing the point.) If not, take a peek at Managing Hierarchical Data in MySQL for some more information.
This article applies to more than just MySQL of course. I personally really like the 'nested set' structure for hierarchies that don't change a lot. Enjoy!
Update: I've just discovered a slightly more verbose example that compares the adjacency list model and the nested set.
One thing I haven't seen discussed, yet, is the idea of adding another 'dimension' to the tree. There is a 'left' and 'right' for the nested set values, but what about adding a 'z' field? (depth) I wonder if the penalties of updating the nodes could be reduced with something like that. Just thinking out loud.
Kurt
PS: What better way to warm up your fingers than hammering out some Perl code! :)
In reply to Re: database table advice
by whereiskurt
in thread database table advice
by coldfingertips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |