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:

e.g.
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.

0 Comments

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…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...