Using Databases to Store Hierarchical Data

Written by James McDonald

March 28, 2011

Databases or more correctly how Databases model things in the real world fascinate me.

Reading up on the CakePHP Tree Behavior I found a link to Managing Hierarchical Data in MySQL

A really good primer on why database tables use a single table to represent Hierarchical Data.

The two examples that that come to my mind are a Bill of Lading and a Recipe or Formula:

Bill of Lading is a parent, The items on the bill of lading are children
A Formula or Recipe is the parent, The ingredients are children, which in turn can have children of their own.

The Managing Hierarchical Data in MySQL article linked to above helps to get your head around how to structure the data sensibly in a database.

I give it 5 stars Dave.


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…