## Hierarchical Model in DBMS

**Hierarchical model** is a data model which uses the tree as its basic structure. So, lets define the basics of the tree.

### Basics of Tree :

- A tree is a data structure that consists of hierarchy of nodes with a single node, called the
**root at highest level**. - A node may have any number of children, but each child node may have only one parent node on which it is dependent. Thus the parent to child relationship in a tree is one to many relationship whereas child to parent relationship in a tree is one to one.

Figure 1 |

- In figure 1, the node at level 1 is called the root node and the nodes at that has no children are called
**leaves.**For example, node 4, 5, 7, 8, 9, 10 and 11. - Nodes that are children of the same parent are called
**siblings**. For example, nodes 2, 3, 4 are siblings. - For any node there is a single path called the
**hierarchical path from the root node**. The nodes along this path are called that nodes**ancestors**. - Similarly for a given node, any node along a path from that node to leaf is called its
**descendent**. - For example, suppose we have to find out the hierarchical path of node 10, then it will be 1→2→6→10 and the ancestors of node 10 are 1, 2 and 6.
- The
**height of tree**is the number of levels on the longest hierarchical path from the root to a leaf. The above tree has a height= 4. - A
**tree is said to be balanced**if every path from the root node to a leaf has the same length.

Figure 2 shows a **balanced and an unbalanced tree**.

Figure 2 |

A **binary tree** is one in which each node has not more than two children.

Figure 3 shows a binary tree

Figure 3 |

#### Example of Hierarchical Model :

**Figure 4 shows**a data structure diagram for a tree representing the STUDENT, FACULTY and CLASS.- The root node chosen is faculty, CLASS as a child of faculty and STUDENT as a child of class.
- The cardinality between CLASS and FACULTY is one to many cardinality as a FACULTY teaches one or more CLASS.
- The cardinality between a CLASS and a STUDENT is also one to many cardinality because a CLASS has many STUDENTS.

Figure 4 |

**Figure 5 shows** an **occurrence of the FACULTY-CLASS-STUDENT**.

Figure 5 |

#### Another Example :

#### Operations on Hierarchical Model

**Deletion-**If CS02 is deleted, then all the students in CS02 class will be deleted. So deletion is very difficult. However deletion of leaf nodes that is students does not create difficulty in deletion.**Insertion-**A new class say, CS03 may not be introduced unless some faculty is available at root level. So insertion is also difficult.**Updation-**Suppose a student has changed his subject from Hindi to Sanskrit, then firstly a search is performed to find out Hindi subject and then an update is made. A search is a time consuming process here.

So these problem occurs in all the three operations.

#### Advantages of Hierarchical Model

- Easy to understand
- Performance is better than relational data model

#### Disadvantages of Hierarchical Model

- Difficult to access values at lower level
- This model may not be flexible to accomodate the dynamic needs of an organisation
- Deletion of parent node result in deletion of child node forcefully
- Extra space is required for the storage of pointers

Previous | Home | Next |

Data Models | The Network Model |

### Incoming search terms:

- hierarchical database model advantages and disadvantages
- advantages and disadvantages of hierarchical data model in dbms
- hierarchical model in dbms
- advantages of hierarchical database model
- advantages and disadvantages of hierarchical model in dbms
- advantages of hierarchical data model
- advantages and disadvantages of hierarchical data model
- advantages and disadvantages of hierarchical database model
- hierarchical data model
- advantage of hierarchical model

An impressive share! I have just forwarded

this onto a colleague who had been doing a little research on this.

Thanks for spending the time to discuss this matter here

on your internet site.