Programming Books C Java PHP Python Learn more Browse Programming Books
Joe Celko's Trees and Hierarchies in SQL for Smarties and over one million other books are available for Amazon Kindle. Learn more
Buy Used
Condition: Used: Good
Comment: Eligible for FREE Super Saving Shipping! Fast Amazon shipping plus a hassle free return policy mean your satisfaction is guaranteed! Good readable copy.
Access codes and supplements are not guaranteed with used items.
Have one to sell? Sell on Amazon
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See this image

Joe Celko's Trees and Hierarchies in SQL for Smarties, (The Morgan Kaufmann Series in Data Management Systems) Paperback – May 21, 2004

ISBN-13: 978-1558609204 ISBN-10: 1558609202 Edition: 1st

Price: $17.99
12 New from $20.22 16 Used from $6.08
Amazon Price New from Used from
"Please retry"
"Please retry"
$20.22 $6.08

Hero Quick Promo
Save up to 90% on Textbooks
Rent textbooks, buy textbooks, or get up to 80% back when you sell us your books. Shop Now

Editorial Reviews


"I want to say clearly that I think the subject of this proposed book is one for which there will be considerable demand...the topic is poorly understood in general and a good book on the subject will be helpful to the SQL community at large. This book should be of great interest to real-world application programmers...I think that this book would be used on a day-to-day basis (rather than languish on a shelf until some special problem arose)." -Jim Melton, author of SQL:1999.

Book Description

Expert advice for smarties from the #1 SQL guru!

Shop the new
New! Introducing the, a hub for Software Developers and Architects, Networking Administrators, TPMs, and other technology professionals to find highly-rated and highly-relevant career resources. Shop books on programming and big data, or read this week's blog posts by authors and thought-leaders in the tech industry. > Shop now

Product Details

  • Series: The Morgan Kaufmann Series in Data Management Systems
  • Paperback: 240 pages
  • Publisher: Morgan Kaufmann; 1 edition (May 21, 2004)
  • Language: English
  • ISBN-10: 1558609202
  • ISBN-13: 978-1558609204
  • Product Dimensions: 7.5 x 0.5 x 9.2 inches
  • Shipping Weight: 1.1 pounds
  • Average Customer Review: 3.5 out of 5 stars  See all reviews (6 customer reviews)
  • Amazon Best Sellers Rank: #1,357,629 in Books (See Top 100 in Books)

More About the Author

I was a member of the ANSI X3H2 Database Standards Committee from 1987 to 1997 and helped write the ANSI/ISO SQL-89 and SQL-92 Standards. I have nine books and have written over 1200 columns in the computer trade and academic press, mostly dealing with data and databases.

I live in Austin,TX. When I am not writing, I am consulting, speaking at conferences, teaching SQL training classes anywhere on Earth or beating up newbies in SQL Newsgroups.

The rumor that I own only one black suit that I have worn for 30 years is false; I own six identical black suits that I have worn for 30 years.

Customer Reviews

3.5 out of 5 stars
Share your thoughts with other customers

Most Helpful Customer Reviews

82 of 84 people found the following review helpful By Steven Wright on July 23, 2004
Format: Paperback
I love and savor each of Celko?s books for their thoroughness, depth and surprises. However, with this book I am little disappointed because it showed his favorite solutions and omitted many common solutions that are better in various real-world situations. Most algorithms provided in the book are for overnight processing, not real-time update.

Omitted is the most common way hierarchies are represented in Data Warehouses using a "hierarchy bridge table". See Kimball?s book "Data Warehouse Toolkit" for more detail (yet not enough detail to give a Celko-like exploration of the topic). The bridge table solution trades away storage space for greater speed by creating a record for every path enumeration.

The book?s primary focus is on strict hierarchies. Not enough attention is given to convergent graphs and other arbitrary directed acyclic graphs, like bill of materials that reuse assemblies, where the nested sets model fails (p.164).

Also missing is maintenance of historical versions of the hierarchy, often required by financial applications.

Section 9.3 on the extremely powerful DB2 ?WITH? operator is too slim, especially since it is a SQL-99 standard and is now available with Microsoft SQL Server. If you work with hierarchies or acyclic graphs in DB2 or SQL Server take the time to learn how to use ?common subquery expressions?.

By all means if you work with hierarchies you must buy this book. No doubt the Second revison of this book will blow us away.
1 Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
8 of 9 people found the following review helpful By Brian E. Mcelaney on January 3, 2007
Format: Paperback
While a little advanced (... the title does say for smarties...) this is one of the few IT books I have ever bought which I read more than once. It's a great mix of brain baking concepts and memory jarring discussions of things you probably slept through your sophomore year. If you've been working with or teaching yourself SQL and are looking to move on to the next step, Celko's books are an excellent place to start.

Note to MySQL users - as of MySQL 5 you can create everything written in this book, although you will need to remove the ATOMIC keyword from the procedures.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
Format: Paperback
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.
1 Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again