Storing deep hierarchies in a database

Introducing nested sets: part one

Bobby Jack

--

Photo by Blake Weyland on Unsplash

The problem we’re trying to solve

Relational databases are great for storing a classic parent/child relationship. Take the example of continents:

continent
id name
1 Europe
2 America

--

--

Bobby Jack

Technologist & writer, Bobby is an Editor at consumer tech site makeuseof.com and ex-Editor-in-Chief of Switch Player Magazine. Read lots more at bobbyjack.me.