I've been brushing up on my MySQL lately and I need to make a database with hierarchical data.
I have several different types of data that need to be represented in a tree format, but don't know how to go about doing it.
For example, Let's say I have a person, who can employ, or be employed by other people. Each of these people may have equipment checked out to them, and each piece of equipment must have a name, description, and a list of replacement parts, and each replacement part must have a cost, etc. etc.
Most examples of closure tables I see focus on how awesome they are for handling forums, or threaded-comments. How do I go about making a closure table that has multiple data types?
Here's a quick and dirty example:
They you can query like:
or summarize the cost of each equipment: