A
hierarchical data model is a
data modelA data model in software engineering is an abstract model that describes how data is represented and accessed. Data models formally define data elements and relationships among data elements for a domain of interest....
in which the data is organized into a tree-like structure. The structure allows repeating information using parent/child relationships: each parent can have many children but each child only has one parent. All attributes of a specific record are listed under an entity type.
In a database, an entity type is the equivalent of a table; each individual record is represented as a row and an attribute as a column.
A
hierarchical data model is a
data modelA data model in software engineering is an abstract model that describes how data is represented and accessed. Data models formally define data elements and relationships among data elements for a domain of interest....
in which the data is organized into a tree-like structure. The structure allows repeating information using parent/child relationships: each parent can have many children but each child only has one parent. All attributes of a specific record are listed under an entity type.
In a database, an entity type is the equivalent of a table; each individual record is represented as a row and an attribute as a column. Entity types are related to each other using
1: N mapping, also known as
one-to-manyIn communication, one-to-many is the act of publishing or broadcasting from one sender to many receivers.One-to-many relationships are often used when managing databases. A one-to-many relationship occurs when one entity is related to many occurrences in another entity...
relationships.
The most recognized and used hierarchical database is
IMSIBM Information Management System is a joint hierarchical database and information management system with extensive transaction processing capabilities.- History :...
developed by IBM.
History
A relational database implementation of this type of data model was first discussed in publication form in 1992 (see also
nested set modelA nested set model is a way of organising hierarchical data in a relational database based upon graph theory and set theory. The earliest mention of this approach seems to be in , however, the name "nested sets" seems to have been first used by Joe Celko....
).
Example
An example of a hierarchical data model would be if an organization had records of employees in a table (entity type) called "Employees". In the table there would be attributes/columns such as First Name, Last Name, Job Name and Wage. The company also has data about the employee’s children in a separate table called "Children" with attributes such as First Name, Last Name, and date of birth. The Employee table represents a parent segment and the Children table represents a Child segment. These two segments form a hierarchy where an employee may have many children, but each child may only have one parent.
Consider the following structure:
| EmpNo | Designation | ReportsTo |
| 10 |
Director |
|
| 20 |
Senior Manager |
10 |
| 30 |
Typist |
20 |
| 40 |
Programmer |
20 |
In this, the "child" is the same type as the "parent". The hierarchy stating EmpNo 10 is boss of 20, and 30 and 40 each report to 20 is represented by the "ReportsTo" column. In Relational database terms, the ReportsTo column is a
foreign keyIn the context of relational databases, a foreign key is a referential constraint between two tables. The foreign key identifies a column or a set of columns in one table that refers to a column or set of columns in another table. The columns in the referencing table must be the primary key or...
referencing the EmpNo column. If the "child" data type were different, it would be in a different table, but there would still be a foreign key referencing the EmpNo column of the employees table.
This simple model is commonly known as the
adjacency listIn graph theory, an adjacency list is the representation of all edges or arcs in a graph as a list.If the graph is undirected, every entry is a set of two nodes containing the two ends of the corresponding edge; if it is directed, every entry is a tuple of two nodes, one denoting the source node...
model, and was introduced by Dr.
Edgar F. CoddEdgar Frank "Ted" Codd was a British computer scientist who, while working for IBM, invented the relational model for database management, the theoretical basis for relational databases...
after initial criticisms surfaced that the relational model could not model hierarchical data.
External links