I have a database of foods, which I would like to divide into a tree structure of categories, subcategories and sub-subcategories. For example,
fruits -> apples -> fuji, or fruits -> apples -> cortland
I would like each parent page to show its immediate children (fruits page shows apples, oranges and all other fruit; apples page shows fuji, cortland and all other apples).
Also, I would like each node to know all its parent nodes. (fuji knows that its parent is apple, whose parent is fruit)
What is the best way to store this tree-like relationship using MySQL?