Data Models
Ms. Bushra Afzal
What is a Data Model?
A data model is a way to organize and structure data so that it
can be stored, managed, and used easily in a database
Types of Data Models
1. Hierarchical Data Model
2. Network Data Model
3. Relational Data Model
Hierarchical Data Model
The Hierarchical Data Model organizes data in a tree-like structure, very
similar to a family tree. In this model, each record has one parent and can
have multiple children, which means the relationship between data elements
is one-to-many. This structure makes it easy to represent data that naturally
follows a hierarchy for example, an organizational chart where the CEO is at
the top, managers are below, and employees are under each manager. The
model is simple and fast for searching because data flows in a single direction
from parent to child. However, it is also very rigid because each child can only
have one parent, and it cannot handle many-to-many relationships.
Structure of Hierarchical Data Model
Network Data Model
The Network Data Model represents data in a graph structure where a
record can have multiple parents and multiple children, allowing many-to-
many relationships. This makes it more f lexible than the hierarchical model.
A real-life example is a student-course enrollment system, where one
student can enroll in many courses and one course can have many students.
Because of this structure, the model can handle complex relationships very
well. However, the design is more complicated, and maintaining the
connections between records can become dif fic ult. It also requires
understanding of pointers, which makes it harder for beginner
Structure of Network Data Model
Relational Data Model
The Relational Data Model stores data in the form of tables (rows and
columns), where each table represents an entity and tables are linked through
keys such as primary keys and foreign keys. This is the most popular model
used in modern databases like MySQL, Oracle, and SQL Server. For example, in
an online shopping system, a Customer table stores customer details and an
Orders table stores their purchases, linked through a customer ID. This model
is very f lexible, easy to understand, and allows powerful querying using SQL. It
also maintains strong data integrity. However, performance may slow down
with very large data sets, especially when complex joins are used.