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 and not in use today.||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.||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.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.