July 2010
Intermediate to advanced
840 pages
16h 33m
English
Since SQL is a set-oriented language, the nested set model is a better model for the approach discussed here. If you have used HTML, XML or a language with a block structure, then you understand the basic idea of this model. The lft and rgt columns (their names are abbreviations for “left” and “right,” which are reserved words in Standard SQL) are the count of the “tags” in an XML representation of a tree.
Imagine circles inside circles without any of them overlapping, the way you would draw a markup language structure. This has some predictable results that we can use for building queries, as shown in Figures 28.2, 28.3, and 28.4.
If that mental model does ...
Read now
Unlock full access