Difference between Hierarchical and Relational data model
1. Hierarchical Data Model :
Hierarchical data model is the oldest type of data model. It was developed by IBM in 1968. It organizes data in tree-like structure. Hierarchical model consists of following :
- It contains nodes which are connected by branches.
- Topmost node is called root node.
- If there are multiple nodes appear at top level, then these can be called as root segments.
- Each node has exactly one parent.
- One parent may have many child.
In the above figure, Electronics is root node which has two children i.e. Televisions and Portable Electronics. These two has further children for which they act as parent. For example: Television has children as Tube, LCD and Plasma, for these three Television act as parent. It follows one to many relationship.
2. Relational Data Model :
Relational data model was developed by E.F. Codd in 1970. Their are no physical links as they are in hierarchical data model. Following are properties of relational data model :
- Data is represented in form of table only.
- It deals only with data not with physical structure.
- It provides information regarding metadata.
- At the intersection of row and column there will be only one value for tuple.
- It provides a way to handle queries with ease.
Difference between Hierarchical and Relational Data Model :
Hierarchical Data Model
Relational Data Model
In this model, to store data hierarchy method is used. It is oldest method. It is the most flexible and efficient database model. It is most used database in today. It implements 1:1 and 1:n. In addition to 1:1 and 1:n it also implements many to many relationships. To organize records, it uses tree structure. To organize records, it uses table. More chances of complexity. No chance of complexity. There is lack of declarative query facility. In current times they are being modelled using NoSQL It provides facility of declarative query facility using SQL. Records are linked with help of pointers. Records are linked with help of rows and columns. Insertion anomaly exits in this model i.e. child node cannot be inserted without parent node. There is no insertion anomaly. Deletion anomaly exists in this model i.e. it is difficult to delete parent node. There is no deletion anomaly. It is used to access data which is complex and asymmetric. It is used to access data which is complex and symmetric. This model lacks data independence. This model provides data independence. This design is used in modern times for faster access of data. This is obtained by trade offs i.e. on giving up on redundancy where the levels(parents to child) are relatively less. Due to many to many to many relationship joins take a heavy toll on search with multiple parameter query Currently this model is being used in shopping carts and search engine. There are tools that can emulate hierarchical database e.g. Mangodb, firebase Most of the traditional software are using relational database common e.g. Oracle dB, MS sql server, IBM DB2
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.