Parent-child hierarchies

A parent-child hierarchy is a hierarchy with multiple levels that track the relationships within the hierarchy.

To create a parent-child hierarchy, you should create a single table or view that represents the parent-child hierarchy. If you need several tables to build the hierarchy, you can create a view that flattens the structure. The top level of the hierarchy uses the parent key as the level key. The bottom level contains the child key. For example, in a hierarchy that represents an organizational structure, you can have two levels: Manager and Employee. The Manager level is the parent level, and the Employee level is the child level.

A parent-child hierarchy can represent an organization chart. For example, Figure 1 shows a chief executive officer (CEO) on the top level of the hierarchy and at least two of the people that might branch off below including the chief operating officer and the executive secretary. The chief operating officer has more people branching off also, but the executive secretary does not. The parent-child relationships on both branches of the hierarchy are consistent. However, the levels of both branches are not logical equivalents. For example, an executive secretary is not the logical equivalent of a chief operating officer.
Figure 1. Parent-child hierarchy
Example of a parent-child hierarchy