Introduction To Hierarchical Database Model
Database Model is a way to define the structure or logical design of a database. It tells the way the data is stored, accessed and updated in DBMS (Database Management System). Now we will discuss the Hierarchical Database Model in detail. There are many data models to represent data. Some are:
- Relational Model
- Hierarchical Model
- Network Model
- Entity-Relationship Model
In Relation, Model data is organized in 2D (two- dimensional) tables where a relationship is maintained by a common field in two tables.
In Hierarchical database model data is represented in a tree-like structure. It represents a parent-child relationship with a single parent for each child.
The network Model is an extension of the Hierarchical model. In this data is represented in the form of graphs with more than one parent node for one child node.
In the Entity-Relationship Model, objects are divided into entities and their characteristics into their attributes and then the relationship is set up between different entities.
Now we will discuss the Hierarchical Database Model in detail.
What Is Hierarchical Database Model
A hierarchical database model is a data model in which data is represented in the tree-like structure. In this model, data is stored in the form of records which are the collection of fields. The records are connected through links and the type of record tells which field is contained by the record. Each field can contain only one value.
A hierarchical database model must have only one parent for each child node but parent nodes can have more than one child. Multiple parents are not allowed. This is the major difference between the hierarchical and network database model. The first node of the tree is called the root node. When data needs to be retrieved then the whole tree is traversed starting from the root node. This model represents one- to- many relationships.
Let us see one example: Let us assume that we have a main directory which contains other subdirectories. Each subdirectory contains more files and directories. Each directory or file can be in one directory only i.e. it has only one parent.
Here A is the main directory i.e. the root node. B1 and B2 are their child or subdirectories. B1 and B2 also have two children C1, C2 and C2, C3 respectively. They may be directories or other files. This depicts one- to- many relationships.
Uses of Hierarchical Database Model
A Hierarchical database model was widely used during the Mainframe Computers Era. Today, a hierarchical database model is used mainly for storing file systems and geographic information. It is used in applications where high performance is required such as telecommunications and banking. A hierarchical database is also used for Windows Registry in the Microsoft Windows operating system. It is useful where the following two conditions are met:
- The data should be in a hierarchical pattern i.e. parent-child relationship must be present.
- The data in a hierarchical pattern must be accessed through a single path only.
Advantages of Hierarchical Database Model
- Data can be retrieved easily due to the explicit links present between the table structures.
- Referential integrity is always maintained i.e. any changes made in the parent table are automatically updated in a child table.
- Promotes data sharing.
- It is conceptually simple due to the parent-child relationship.
- Database security is enforced.
- Efficient with 1: N relationships.
- A clear chain of command or authority.
- Increases specialization.
- High performance.
- Clear results.
Disadvantages of Hierarchical Database Model
- If the parent table and child table are unrelated then adding a new entry in the child table is difficult because additional entry must be added in the parent table.
- Complex relationships are not supported.
- Redundancy which results in inaccurate information.
- Change in structure leads to change in all application programs.
- M: N relationship is not supported.
- No data manipulation or data definition language.
- Lack of standards.
- Poor flexibility
- Communication barriers
- Organizational Disunity.
- Rigid structure
Features of the Hierarchical Database Model:
- Many to many relationships: It only supports one – to – many relationships. Many to many relationships are not supported.
- Problem in Deletion: If a parent is deleted then the child automatically gets deleted.
- Hierarchy of data: Data is represented in a hierarchical tree-like structure.
- Parent-child relationship: Each child can have only one parent but a parent can have more than one children.
- Pointer: Pointers are used for linking records that tell which is a parent and which child record is.
- Disk input and output is minimized: Parent and child records are placed or stored close to each other on the storage device which minimizes the hard disk input and output.
- Fast navigation: As parent and child are stored close to each other so access time is reduced and navigation becomes faster.
- Predefined relationship: All relations between root, parent and child nodes are predefined in the database schema.
- Re-organization difficulty: Hierarchy prevents the re-organization of data.
- Redundancy: One to many relationships increases redundancy in the data which leads to the retrieval of inaccurate data.
Let us take an example of college students who take different courses. A course can be assigned to an only single student but a student can take as many courses as they want therefore following one to many relationships.
Now we can represent the above hierarchical model as relational tables as shown below:
In this manner, the hierarchical model can be represented in relational tables and vice versa can also be done.
In this article, we have discussed the hierarchical database model in detail which depicts the parent-child relationship which makes it easy to represent data and understand the concept easily. It was mostly used in times of mainframe computers but still, it is used in many fields where high performance and easy concepts are the parameters. So the hierarchical model is efficient for one to many relationships and is widely used in recording file system data.
This has been a guide to Hierarchical Database Model. Here we discussed the Basic concepts, Definition, and Advantages of Hierarchical Database Model. You can also go through our other suggested articles to learn more –