What is hierarchical database

Hierarchical database is a tree-like structure data model. This structure is the first database model that was developed by IBM in the 1960s.

The first record of this data model is a root record. It is the entrance to database. This root record stays in the parent table. The other tables are spread from the root node like the branches of a tree. These tables are known as child table. The relation between parent table and child table can be one-to-one and one-to-many.

Hierarchical database

Hierarchical database is based on parent-child relationship. Here each record has one parent and many children.  The schema is like that each child record has only one parent, whereas each parent record can have one or more child records. In Hierarchical database the relationship between the records is confined to` one to many’ relationships.

For example, if an employee can work in only one department, it is logical, one-to-many relationship from a DEPARTMENTS table to an EMPLOYEES table. The EMPLOYEES table has a foreign key, DEPTID; back to the DEPARTMENTS table primary key, DEPTID.

Hierarchical database model example

In this picture, the DEPARTMENTS data table represents the “parent” part of the hierarchy, while the EMPLOYEES table represents the “child” part of the hierarchy. As shown, each department may have one or many employee, but each employee may have only one department to report.

Pros and cons of this data model

  • The presence of explicit links between the table structures is helpful for retrieving .data very quickly.
  • Hierarchical systems are good for data retrieval if the structure of all possible queries can be known beforehand.
  • This data model limited to storing data in One-to–many relationships but cannot represents many-to-many relationships among the records.
  • Though the hierarchical data model lost its appeal after the advent of  Codd’s relational model in mainstream database management systems, the hierarchical databases are still widely used in banking and telecommunications sectors in applications that require very high performance and availability.
  • Though this structure is simple, it is inflexible because the relationship is confined to a one-to-many relationship.
  • Disadvantages of hierarchical database structures are that certain attribute values may have to be repeated many times leading to data redundancy, which increases storage and access costs.

Popular hierarchical databases

The example of this data model is IBM’s Information Management System (IMS) and Windows registry in the Microsoft Windows operating systems.XML and XAML are based on hierarchical data model. 

Related posts :