O'Reilly logo

Joe Celko's SQL for Smarties, 5th Edition by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 28

Trees and Hierarchies in SQL

Abstract

A tree is a special kind of directed graph. A hierarchy is a special kind of tree. IMS and other early databases, operating systems, and file systems are based on this model. It can be modeled with SQL.

Keywords

n-Ary tree

Subtrees

Leaf node

Root node

Adjacency list model

Nested sets model

Subordinates

Path

Parts explosion

A tree is a special kind of directed graph. Graphs are data structures that are made up of nodes (usually shown as boxes) connected by edges (usually shown as lines with arrowheads). Each edge represents a one-way relationship between the two nodes it connects. In an organizational chart, the nodes are employees and each edge is the “reports to” relationship. In a parts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required