0% found this document useful (0 votes)
6 views31 pages

02-Data Model & E-R Diagram

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views31 pages

02-Data Model & E-R Diagram

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Fundamentals of Database Systems

Data Model & ER (Entity Relationship) Diagram in DBMS

Prepared by: Abdul Wajid Fazil

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 1


Chapter objectives
 Understand concept and types of data model
 How to use ER modeling in database design?

 The basic concepts of an ER model called entities,


relationships, and attributes.
 ER Diagram
A diagrammatic technique for displaying an ER
model.
 How to identify and solve problems in an ER model
called connection traps.
Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 2
What is data model?
 Data modeling is the process of creating a data
model for the data to be stored in a Database.
 Data modeling is an integral part of the process of
designing and development a data system.
 Provides a method and means for describing the
real-world information requirements in a
understandable manner to the stakeholder in an
organization.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 3


Data life cycle
 Needing data.
 Determining needed data.
 Gathering needed data
 Storing data
 Using data
 Deleting obsolete data
 Archiving historical data

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 4


Why we are using Data Model?
 Ensures that all data objects required by the database
are accurately represented.
 A data model helps design the database at the
conceptual, physical and logical levels.
 Data Model structure helps to define the relational
tables, primary and foreign keys and stored procedures.
 It provides a clear picture of the base data and can be
used by database developers to create a physical
database.
 It is also helpful to identify missing and redundant data.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 5


Types of Data Models
 There are mainly three different types of data
model:
1) Conceptual: This Data Model defines WHAT the
system contains.
2) Logical: Defines HOW the system should be
implemented regardless of the DBMS.
3) Physical: This Data Model describes HOW the
system will be implemented using a specific DBMS
system.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 6


Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 7
Conceptual Data Model Example
 Customer and Product are two entities.
 Customer name and number are attributes of the
Customer entity.
 Product name and price are attributes of product
entity.
 Sale is the relationship between the customer and
product.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 8


Logical Data Model Example
 At this Data Modeling level, no primary or
secondary key is defined.
 At this Data modeling level, you need to verify
and adjust the connector details that were set
earlier for relationships.

Fundamentals of Database Systems Lecture 03 Summer 2023


L ogical Data Model
08/07/2024 9
Physical Data Model Example

Physical Data Model

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 10


Advantages of Data model:

 The main goal of a designing data model is to make certain


that data objects offered by the functional team are
represented accurately.
 The data model should be detailed enough to be used for
building the physical database.
 The information in the data model can be used for defining
the relationship between tables, primary and foreign keys,
and stored procedures.
 Data Model helps business to communicate the within and
across organizations.
 Help to recognize correct sources of data to populate the
model.
Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 11
Cont.
 Enhance the performance of your application and
database.
 Improve communication between the
development and Business Intelligence teams.
 Make database design easier and faster at the
conceptual, logical, and physical levels.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 12


Disadvantages of Data model:
 To develop Data model one should know physical
data stored characteristics.
 This is a navigational system produces complex
application development, management. Thus, it
requires a knowledge of the biographical truth.
 Even smaller change made in structure require
modification in the entire application.
 There is no set data manipulation language in
DBMS.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 13


ER (Entity Relationship) Diagram in DBMS
 ER model stands for an Entity-Relationship model.
It is a high-level data model. This model is used to
define the data elements and relationship for a
specified system.
 It develops a conceptual design for the database.
It also develops a very simple and easy to design
view of data.
 In ER modeling, the database structure is
portrayed as a diagram called an entity-
relationship diagram.
Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 14
Component of ER Diagram

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 15


Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 16
Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 17
1. Entity:
 An entity may be any object, class, person or
place. In the ER diagram, an entity can be
represented as rectangles.
A set of objects with the same properties, which
are identified by a user or organization as having
an independent existence.
 Consider an organization as an example- manager,
product, employee, department etc. can be taken
as an entity.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 18


A. Weak Entity
An entity that depends on another entity called a
weak entity. The weak entity doesn't contain any
key attribute of its own. The weak entity is
represented by a double rectangle.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 19


2. Attribute
 The attribute is used to describe the property of
an entity. Eclipse is used to represent an
attribute.
 For example, id, age, contact number, name, etc.
can be attributes of a student.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 20


a. Key Attribute
 The key attribute is used to represent the main
characteristics of an entity. It represents a
primary key. The key attribute is represented by
an ellipse with the text underlined.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 21


b. Composite Attribute
 An attribute that composed of many other
attributes is known as a composite attribute. The
composite attribute is represented by an ellipse,
and those ellipses are connected with an ellipse.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 22


c.Multivalue attribute
 An attribute can have more than one value. These
attributes are known as a multivalued attribute.
The double oval is used to represent multivalued
attribute.
 For example, a student can have more than one
phone number.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 23


d. Derived Attribute
 An attribute that can be derived from other
attribute is known as a derived attribute. It can
be represented by a dashed ellipse.
 For example, A person's age changes over time
and can be derived from another attribute like
Date of birth.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 24


3. Relationship
A relationship is used to describe the relation
between entities. Diamond or rhombus is used to
represent the relationship.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 25


a. One-to-One Relationship
 When only one instance of an entity is associated
with the relationship, then it is known as one to
one relationship.
 For example, A female can marry to one male,
and a male can marry to one female.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 26


b. One-to-many relationship
 When only one instance of the entity on the left,
and more than one instance of an entity on the
right associates with the relationship then this is
known as a one-to-many relationship.
 For example, Scientist can invent many
inventions, but the invention is done by the only
specific scientist.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 27


c. Many-to-one relationship
 When more than one instance of the entity on the
left, and only one instance of an entity on the
right associates with the relationship then it is
known as a many-to-one relationship.
 For example, Student enrolls for only one course,
but a course can have many students.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 28


d. Many-to-many relationship
 When more than one instance of the entity on the
left, and more than one instance of an entity on
the right associates with the relationship then it is
known as a many-to-many relationship.
 For example, Employee can assign by many
projects and project can have many employees.

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 29


Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 30
Question? Suggestion* and objection!

Fundamentals of Database Systems Lecture 03 Summer 2023 08/07/2024 31

You might also like