A technique for representing the structure of hierarchically-organized data in
a non-hierarchical data structure, such as a relation. The hierarchically-organized
data is represented as a tree, and each node in the tree is assigned a position
identifier that represents both the depth level of the node within the hierarchy,
and its ancestor/descendant relationship to other nodes. The data represented by
each node, as well as its position identifier, is stored in a row of a relational
database, thereby capturing the hierarchical structure of the data in such relational
database. A technique is provided for the compressed storage of position identifiers
in a format that allows an efficient bytewise comparison of position identifiers
to determine relative order and ancestry.