About Parent-Child Hierarchies
A parent-child hierarchy is a hierarchy of members that all have the same type. For example, employee or assembly.
This contrasts with level-based hierarchies, where members of the same type occur only at a single level of the hierarchy.
A common real-life parent-child hierarchy occurrence is an organizational reporting hierarchy chart. In an organizational reporting hierarchy chart, the following can apply:
-
Each individual in the organization is an employee.
-
Each employee, apart from the top-level managers, reports to a single manager.
-
The reporting hierarchy has many levels.
These conditions illustrate the basic features that define a parent-child hierarchy, namely:
-
A parent-child hierarchy is based on a single logical table, for example, the Employees table.
-
Each row in the table contains two identifying keys, one to identify the member itself, the other to identify the parent of the member, for example, Emp_ID and Mgr_ID.
The image shows an example of a multi-level parent-child hierarchy.
The following table shows how this parent-child hierarchy could be represented by the rows and key values in an Employees table.
| Emp_ID | Mgr_ID |
|---|---|
|
Andrew |
null |
|
Barbara |
Andrew |
|
Carlos |
Andrew |
|
Dawn |
Barbara |
|
Emre |
Barbara |
You can expose logical parent-child hierarchies to users by creating presentation hierarchies that are based on particular logical hierarchies. Creating hierarchies in the presentation layer enables users to create hierarchy-based queries.
