Chapter 29. Effective use of HierarchyId

Denis Reznik

We find hierarchies in many places in our lives, such as organizational structures, sporting events, product categories in an e-market, social relationships, algorithms, classifications, and elsewhere. Modeling such systems means creating and storing information about the objects in a system. Tons of code was written using object-oriented programming principles, and many variants of storing information about objects in a database were invented. Hierarchy is a type of relationship between objects, and that’s why modeling hierarchies is a common operation in writing code and databases.

Hierarchies in a database

There are many types of hierarchy implementations in a database. Parent-child ...

Get SQL Server MVP Deep Dives Vol. 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.