Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
I N T R O D U C T I O N An introduction should give a noble purpose for writing a book. I should say that the purpose of this book is to help real programmers who have real problems in the real world. But the "real" reason this short book is being published is to save me the trouble of writing any more emails and pasting more code on Internet forums, newsgroups, and blogs. This topic has been hot on all SQL-related Websites, and the solutions actually being used by most working programmers have been pretty bad. So I thought, why not collect everything I can find and put it in one place for the world to see. In my book SQL for Smarties (Morgan-Kaufmann, 4th edition, 2010, ISBN 978-0123820228, Chapter 36), I wrote a chapter on a programming technique for representing trees and hierarchies in SQL as nested sets. This technique has become popular enough that I have spent almost every month since SQL for Smarties was released explaining the technique in Newsgroups