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…

Network speed test host to host

On Ubuntu / Debian apt-get install iperf3 On Windows download it from https://iperf.fr/iperf-download.php#windows Make...

Clear HSTS Settings in CHrome

Open chrome://net-internals/#hsts enter the domain in the query field and click Query to confirm it has HSTS settings...