CHAPTER 2 Adjacency List Model

IN THE EARLY days of System R at IBM one of the arguments against a relational database was that SQL could not handle hierarchies the way IMS could (see Chapter 12), and would therefore not be practical for large databases. It might have a future as an ad hoc query language, but that was the best that could be expected of it.

In a short paper Dr. E. F. Codd described a method for showing hierarchies in SQL that consisted of a column for the boss and another column for the employee in the relationship. It was a direct implementation in a table of the Adjacency List Model of a graph. Oracle was the first commercial database to use SQL, and the sample database that comes with their product, nicknamed the “Scott/Tiger” ...

Get Joe Celko's Trees and Hierarchies in SQL for Smarties now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.