Hierarchical data has a parent-child relationship that is not naturally represented in a relational database table.
For our purposes, hierarchical data is a collection of data where each item has a single parent and zero or more children (with the exception of the root item, which has no parent).
The most common and familiar is known as the adjacency model, and it usually works like this: It's called the "adjacency" model because the parent (boss) data is stored in the same row as the child (employee) data, in an adjacent column.
It's a pretty straightforward design that's easily understood by everyone..deep relational theory needed. Employee ID For each level, you'd need to join the table to itself..an attractive option if you have 5 or more levels!
There are several different ways to model a hierarchical structure.Hierarchies may be expressed easily by switching to a graph database.Alternatively, several resolutions exist for the relational model and are available as a workaround in some relational database management systems: When these solutions are not available or not feasible, another approach must be taken.The technique is an answer to the problem that the standard relational algebra and relational calculus, and the SQL operations based on them, are unable to express all desirable operations on hierarchies directly.A hierarchy can be expressed in terms of a parent-child relation - Celko calls this the adjacency list model - but if it can have arbitrary depth, this does not allow the expression of operations such as comparing the contents of hierarchies of two elements, or determining whether an element is somewhere in the subhierarchy of another element.