Chapter 2
Chapter 2
Data Models
Prepared By:
Ms. Ayushi Gondaliya
Assistant Prof.
SRCOE, RAJKOT
Data Models
Data Models
◦ Data Model is the modeling of the data
description, data semantics, and consistency
constraints of the data.
◦ It provides the conceptual tools for describing
the design of a database at each level of data
abstraction.
Data model Schema and Instance
Saving-account Current-account
Sub Class
A sub class is an entity that is derived
from another entity.
E.g. saving-account and current-account is
derived from entity account.
So, saving-account and current-account
are sub class.
Account Sub Class
Current-account Saving-account
Generalization
Generalization is like a bottom-up approach in which
two or more entities of lower level combine to form
a higher level entity if they have some attributes in
common.
For example, Faculty and Student entities can be
generalized and create a higher level entity Person.
Specialization
Specialization is a top-down approach, and it is opposite to
Generalization. In specialization, one higher level entity can
be broken down into two lower level entities.
For example: In an Employee management system,
EMPLOYEE entity can be specialized as TESTER or
DEVELOPER based on what role they play in the company.
Generalization
Specialization
Aggregation
Aggregation is a process in which a
single entity alone is not able to make
sense in a relationship so the relationship
of two entities acts as one entity.
Process of creating an entity by combining
various components of E-R diagram is
called aggregation
Data Models
Data Model is the modeling of the data
description, data semantics, and
consistency constraints of the data.
It provides the conceptual tools for
describing the design of a database at
each level of data abstraction.
The most famous example of database
model is the relational model, which uses
a table-format.
Types of database models:
Hierarchical Model
Network Model
E-R Model
Relational model
Object Oriented database Model
Hierarchical Model
A hierarchical model represents the data in a tree-
like structure in which there is a single parent for
each record.
The hierarchy starts from the Root data, and
expands like a tree, adding child nodes to the
parent nodes.
In hierarchical model, data is organized into tree-
like structure with one-to-many relationship
between two different types of data.
for example shown in fig., one department can have
many courses, many professors and of-course many
students.
Hierarchical Model
Network Model
This is an extension of the Hierarchical model.
In this model data is organized more like a
graph, and are allowed to have more than one
parent node.
In this database model data is more related as
more relationships are established in this
database model.
This database model was used to map many-to-
many data relationships.
Network Model
E-R Model
In this database model, relationships are created by
dividing object of interest into entity and its
characteristics into attributes.
This model is good to design a database, which can
then be turned into tables in relational model.
example, If we have to design a School Database,
then…
◦ Student will be an entity with attributes name, age,
address etc. As Address is generally complex, it can be
another entity with attributes street name, pincode, city
etc, and there will be a relationship between them.
E-R Model
Relational Model
The basic structure of data in the relational
model is tables. All the information related to a
particular type is stored in rows of that table.
In this model, data is organized in two-
dimensional tables and the relationship is
maintained by storing a common field.
Hence, tables are also known as relations in
relational model.
Relational Model
S_id Name age Sub_id name teacher
1 Abc 20 1 Dbms ASG
2 Cde 21 2 Ds MRP
Foreign key
P_id P_name P_age Ordr_id Ordr_no P_id
1 Abc 17 1 1234 2
2 def 22 2 4567 1
Person Order
Thank You