Joe Celko's Trees and Hierarchies in SQL for Smarties

Joe Celko's Trees and Hierarchies in SQL for Smarties

The Morgan Kaufmann Series in Data Management Systems
2004, Pages 35-43
Joe Celko's Trees and Hierarchies in SQL for Smarties

Chapter 3 - Path Enumeration Models

https://doi.org/10.1016/B978-155860920-4/50004-0Get rights and content

Publisher Summary

One of the properties of trees is that there is one path from the root to every node in a tree. The path enumeration model stores that path as a string by concatenating either the edges or the keys of the nodes in the path. Searches are done with string functions and predicates on those path strings. The chapter focuses on these path enumeration models. There are two methods for enumerating the paths: edge enumeration and node enumeration. The node enumeration is the most commonly used method of the two methods, and there is little difference in the basic string operations on either model. However, the edge enumeration model has some numeric properties that can be useful. The chapter describes SQL codes used for common operations on a tree graph based on path enumeration, such as finding the depth of the tree, searching for subordinates, searching for superiors, deleting a subtree, deleting a single node, inserting a new node, and splitting up a path string. In the edge enumeration model, the directions for following the path from the root to each node are given as integers. The path column contains a string of the edges that make up a path from the root to each node, numbering them from left to right at each level in the tree. This assigns a partial ordering to the nodes of the trees. The main advantage of this notation is its ability to handle long strings. The chapter discusses another database language known as XML.

References (0)

Cited by (0)

View full text