Review – Joe Celko’s Trees and Hierarchies in SQL for Smarties

When I started looking into managing hierarchical data I found a lot of short articles that provided bits and pieces of the big picture, but nothing gave a good in-depth review of everything I needed to know to handle hierarchies.

One trend that began to develop was that the best information on the subject was coming from Joe Celko, a rather prolific author/speaker on all things SQL.

Joe Celko has a book in publication called SQL For Smarties, and this book had some basic information on handling hierarchies, which he followed up with Trees and Hierarchies in SQL for Smarties, a truly excellent book on the subject.

This book is not for the faint of heart, but it really is a must-read for those who are looking to handle hierarchies in SQL.

The book only addresses MySQL once, and while in that section it repeats Joe’s opinion of MySQL not being a real database, users of MySQL 5 can rest assured that the stored procedure examples in the book work without modification (thanks to Joe and MySQL 5 both using the standard PL/PSM stored procedure syntax).

Overall this is an excellent book for those looking to implement hierarchical data in SQL.



, ,




3 responses to “Review – Joe Celko’s Trees and Hierarchies in SQL for Smarties”

  1. Joe Celko Avatar

    MySQL has gotten a lot closer to ANSI/ISO Standard SQL since I wrote that. But I have not played with the SQL/PSM.

    1. Mike Hillyer Avatar
      Mike Hillyer

      Thanks for the update Joe, the book has served me well over the years.

  2. Arjen Lentz Avatar

    I’ve been in touch with Joe since the release of MySQL 5.0 years ago, and he did revise his opinion on MySQL based on the 5.0 feature set and cleanups. However, the trees/hierarchies book either predates this, or the chapters were copied from SQL for Smarties without modification.

    But when talking about this topic, OQGRAPH is so much easier than all this. Kinda makes it obsolete 😉