Page 236 - PYTHON-12
P. 236
12.3.1 Types of Data Models
Data models are categorized into three different categories:
DATA MODELS
Object-based Record-based Physical
data model data model data model
Hierarchical model Network Model Relational model
(Tree structures) (Directed graphs) (Files/Tables/Relations)
Fig. 12.7: Classification of Data Models
12.3.1.1 Hierarchical Data Model
In a hierarchical model, records are organized as trees rather than graphs, i.e., hierarchical model
represents a hierarchy of parent and child data segments. It is represented by an upside-down “tree”.
Hierarchical model depicts one-to-many (1:M) relationships between a parent and child segment. Each
parent can have many children, but vice versa does not hold true, i.e., each child has only one parent.
Fig. 12.8: Hierarchical Model
From Fig. 12.8, we can see that the student database contains various files related to a student. In
this kind of arrangement, a file higher in the hierarchy is known as parent of the files contained
inside it. Here, Student is a parent of the Library, Fees and Exam files respectively. Thus, this
model represents a one-to-many relationship between a parent and its children in the form of a
hierarchical (upside-down) tree. The advantages of this model are:
Computer Science with Python–XII 12.6 3. Parent-child relationship promotes data integrity.
1. It is simple in operation and in concept.
2. It promotes data sharing.
4. It is efficient and can be naturally mapped for 1: M (one-to-many) relationships.
The limitations of this model are as follows:
1. It is suitable for hierarchical relationships only; otherwise, it is inflexible for non-hierarchical
relationship mapping.
2. Implementation is complex and difficult since it is done using pointers from a parent to its
children which require extra memory space.