Entity Relationship
(E-R) Model
Database Management System
Date – 20/04/2019
RAMKRISHNA MAHATO GOVERNMENT
ENGINEERING COLLEGE
1
Presented by:
NAME ROLL NO.
1.SHILPA DE 35000116019
2.SAYAN DAS 35000116021
3.SANJIT MONDAL 35000116022
4.SAIKAT PAL 35000116023
5.ROHIT MAHATO 35000116024
2
Contents
 Entity
 Attribute
 Classes of attributes
 Relationships
 Relationship Constraint
 Weak Entity
 Notations for ER Diagram
 Specialization
 Generalization
 Aggregation
3
 E-R Model Components
 Entities
 In E-R models an entity refers to the entity set.
 An entity is represented by a rectangle containing the
entity’s name.
 Attributes
 Attributes are represented by ovals and are connected to
the entity with a line.
 Each oval contains the name of the attribute it represents.
 Attributes have a domain -- the attribute’s set of possible
values.
 Attributes may share a domain.
 Primary keys are underlined.
 Relationships
4
The Attributes of the STUDENT and CAR Entity
5
 Classes of Attributes
 A Single-valued attribute can have only a single value.
 Examples:
 A person can have only one social security
number.
 A manufactured part can have only one serial
number.
 Multi-valued attributes can have many values.
 Examples:
 A person may have several college degrees.
 A household may have several phones with
different numbers
 Multi-valued attributes are shown by a double line
connecting to the entity.
6
Splitting the Multivalued Attributes into New Attributes7
 Classes of Attributes
 A simple attribute cannot be subdivided.
 Examples: Age, Sex, and Marital status
 A composite attribute can be further subdivided to
yield additional attributes.
 Examples:
 ADDRESS Street, City, State, Zip
 PHONE NUMBER Area code, Exchange number
8
address
Street city zip
 A derived attribute is not physically stored within the
database; instead, it is derived from stored attributes.
 Example: AGE can be derived from the data of birth and
the current date.
Figure: A Derived Attribute
9
 A relationship is an association between entities.
 Relationships are represented by diamond-shaped
symbols like “ “
Figure :An Entity Relationship
Relationships10
Types of relationship:
 Unary relationship
 Binary relationship
 Ternary relationship
11
One to One relationship:12
A
B
C
1
2
3
One to many relationship:13
A
B
P
Q
R
S
Many to many relationship:14
A
B
C
X
Y
Z
W
Unary Relationship
• Relationship between the instances of one entity
type.
Is_married_to Manages
PERSON
EMPLOYEE
One-to-one One-to-many
15
EMPLOYEE
PARKING
SPACE
PRODUCT
LINE
PRODUCTS
Is_assigned
Binary Relationship
• Relationship between the instances of two entity type.
Contains
One-to-One
One-to-Many
1 M
1 1
Can also have many to many!
16
Ternary Relationship
• A simultaneous relationship among instances of
three entity types.
EMPLOYEE
JOB
DEPARTMENTWorks_On
17
 Cardinality
 Cardinality expresses the specific number of entity
occurrences associated with one occurrence of the
related entity.
Figure :Cardinality in an ERD
Relationship Constraints18
Cardinality Ratio Example
Student
Hostel
Room
Student
Resides
in
1 1
Address
N
a
m
e
Roll
Hostel
name
Room
no
professor
Depart-
mentBelongs
to
N 1
Name
Phone
No
19
• Disjoint
• Completeness constraint (use double lines)
– total : an entity must belong to one of the lower-
level entity sets
– partial: an entity need not belong to one of the
lower-level entity sets
Participation20
 A weak entity is an entity that
 Is existence-dependent and
 Has a primary key that is partially or totally derived
from the parent entity in the relationship.
 The existence of a weak entity is indicated by a
double rectangle.
 The weak entity inherits all or part of its primary
key from its strong counterpart.
Weak Entities21
• Double rectangles for weak entity set
• Double diamond for weak entity relationship
• Dashed underscore for discriminator
Example
Weak Entity Set Notations22
Summary of Symbols Used in E-R Notation
23
Super class and Sub class
entity type
 A super class is an entity type that
includes distinct sub classes.
 A Sub class is an entity type that has
a distinct roll and also a member of
super class
Advantages:
1.It eliminates the requirement of describing
Similar concepts more than once. Thus saving
Time from data modeling.
2. Add more semantic content and information
to the design
24
EXAMPLE
Employee
Employee
No
Date of
joining
Name DOB
Address
Full Time Part Time Consultant
Salary Allowance Hourly
Rate
Contact
no
Billingrate
25
Extended E-R Features: Specialization
• Top-down design process.
• A lower-level entity set inherits all the attributes and
relationship participation of the higher-level entity set
to which it is linked.
• A lower-level entity set may have additional attributes
and participate in additional relationships
• Depicted by a triangle component labeled ISA (E.g.
customer “is a” person).
26
Specialization Example
27
Extended ER Features: Generalization
A bottom-up design process – combine a
number of entity sets that share the same
features into a higher-level entity set.
Specialization and generalization are
simple inversions of each other; they are
represented in an E-R diagram in the
same way.
The terms specialization and
generalization are used interchangeably.
28
29
Generalization Example
30 Components of the E-R Model
Aggregation
Consider the ternary relationship works_on
Suppose we want to record managers for tasks performed by an
employee at a branch
31
Aggregation (Cont.)
Relationship sets works_on and manages represent
overlapping information
Every manages relationship corresponds to a works_on
relationship
However, some works_on relationships may not
correspond to any manages relationships
So we can’t discard the works_on relationship
Eliminate this redundancy via aggregation
Treat relationship as an abstract entity
Allows relationships between relationships
Abstraction of relationship into new entity
Without introducing redundancy, the following diagram
represents:
An employee works on a particular job at a particular
branch
An employee, branch, job combination may have an
associated manager
32
E-R Diagram With Aggregation
Higher level
entity type
33
References:
1.TEXTBOOK : Fundamentals of Database
System (PEARSON)
2. TEXTBOOK : Database System Concepts
(McGraw-Hill Education)
2. NOTEBOOK : PROF. PABITRA ROY
3. WEBSITE : www.google.com
4. www.youtube.com
5. nptel.ac.in
34

ER model

  • 1.
    Entity Relationship (E-R) Model DatabaseManagement System Date – 20/04/2019 RAMKRISHNA MAHATO GOVERNMENT ENGINEERING COLLEGE 1
  • 2.
    Presented by: NAME ROLLNO. 1.SHILPA DE 35000116019 2.SAYAN DAS 35000116021 3.SANJIT MONDAL 35000116022 4.SAIKAT PAL 35000116023 5.ROHIT MAHATO 35000116024 2
  • 3.
    Contents  Entity  Attribute Classes of attributes  Relationships  Relationship Constraint  Weak Entity  Notations for ER Diagram  Specialization  Generalization  Aggregation 3
  • 4.
     E-R ModelComponents  Entities  In E-R models an entity refers to the entity set.  An entity is represented by a rectangle containing the entity’s name.  Attributes  Attributes are represented by ovals and are connected to the entity with a line.  Each oval contains the name of the attribute it represents.  Attributes have a domain -- the attribute’s set of possible values.  Attributes may share a domain.  Primary keys are underlined.  Relationships 4
  • 5.
    The Attributes ofthe STUDENT and CAR Entity 5
  • 6.
     Classes ofAttributes  A Single-valued attribute can have only a single value.  Examples:  A person can have only one social security number.  A manufactured part can have only one serial number.  Multi-valued attributes can have many values.  Examples:  A person may have several college degrees.  A household may have several phones with different numbers  Multi-valued attributes are shown by a double line connecting to the entity. 6
  • 7.
    Splitting the MultivaluedAttributes into New Attributes7
  • 8.
     Classes ofAttributes  A simple attribute cannot be subdivided.  Examples: Age, Sex, and Marital status  A composite attribute can be further subdivided to yield additional attributes.  Examples:  ADDRESS Street, City, State, Zip  PHONE NUMBER Area code, Exchange number 8 address Street city zip
  • 9.
     A derivedattribute is not physically stored within the database; instead, it is derived from stored attributes.  Example: AGE can be derived from the data of birth and the current date. Figure: A Derived Attribute 9
  • 10.
     A relationshipis an association between entities.  Relationships are represented by diamond-shaped symbols like “ “ Figure :An Entity Relationship Relationships10
  • 11.
    Types of relationship: Unary relationship  Binary relationship  Ternary relationship 11
  • 12.
    One to Onerelationship:12 A B C 1 2 3
  • 13.
    One to manyrelationship:13 A B P Q R S
  • 14.
    Many to manyrelationship:14 A B C X Y Z W
  • 15.
    Unary Relationship • Relationshipbetween the instances of one entity type. Is_married_to Manages PERSON EMPLOYEE One-to-one One-to-many 15
  • 16.
    EMPLOYEE PARKING SPACE PRODUCT LINE PRODUCTS Is_assigned Binary Relationship • Relationshipbetween the instances of two entity type. Contains One-to-One One-to-Many 1 M 1 1 Can also have many to many! 16
  • 17.
    Ternary Relationship • Asimultaneous relationship among instances of three entity types. EMPLOYEE JOB DEPARTMENTWorks_On 17
  • 18.
     Cardinality  Cardinalityexpresses the specific number of entity occurrences associated with one occurrence of the related entity. Figure :Cardinality in an ERD Relationship Constraints18
  • 19.
    Cardinality Ratio Example Student Hostel Room Student Resides in 11 Address N a m e Roll Hostel name Room no professor Depart- mentBelongs to N 1 Name Phone No 19
  • 20.
    • Disjoint • Completenessconstraint (use double lines) – total : an entity must belong to one of the lower- level entity sets – partial: an entity need not belong to one of the lower-level entity sets Participation20
  • 21.
     A weakentity is an entity that  Is existence-dependent and  Has a primary key that is partially or totally derived from the parent entity in the relationship.  The existence of a weak entity is indicated by a double rectangle.  The weak entity inherits all or part of its primary key from its strong counterpart. Weak Entities21
  • 22.
    • Double rectanglesfor weak entity set • Double diamond for weak entity relationship • Dashed underscore for discriminator Example Weak Entity Set Notations22
  • 23.
    Summary of SymbolsUsed in E-R Notation 23
  • 24.
    Super class andSub class entity type  A super class is an entity type that includes distinct sub classes.  A Sub class is an entity type that has a distinct roll and also a member of super class Advantages: 1.It eliminates the requirement of describing Similar concepts more than once. Thus saving Time from data modeling. 2. Add more semantic content and information to the design 24
  • 25.
    EXAMPLE Employee Employee No Date of joining Name DOB Address FullTime Part Time Consultant Salary Allowance Hourly Rate Contact no Billingrate 25
  • 26.
    Extended E-R Features:Specialization • Top-down design process. • A lower-level entity set inherits all the attributes and relationship participation of the higher-level entity set to which it is linked. • A lower-level entity set may have additional attributes and participate in additional relationships • Depicted by a triangle component labeled ISA (E.g. customer “is a” person). 26
  • 27.
  • 28.
    Extended ER Features:Generalization A bottom-up design process – combine a number of entity sets that share the same features into a higher-level entity set. Specialization and generalization are simple inversions of each other; they are represented in an E-R diagram in the same way. The terms specialization and generalization are used interchangeably. 28
  • 29.
  • 30.
    30 Components ofthe E-R Model
  • 31.
    Aggregation Consider the ternaryrelationship works_on Suppose we want to record managers for tasks performed by an employee at a branch 31
  • 32.
    Aggregation (Cont.) Relationship setsworks_on and manages represent overlapping information Every manages relationship corresponds to a works_on relationship However, some works_on relationships may not correspond to any manages relationships So we can’t discard the works_on relationship Eliminate this redundancy via aggregation Treat relationship as an abstract entity Allows relationships between relationships Abstraction of relationship into new entity Without introducing redundancy, the following diagram represents: An employee works on a particular job at a particular branch An employee, branch, job combination may have an associated manager 32
  • 33.
    E-R Diagram WithAggregation Higher level entity type 33
  • 34.
    References: 1.TEXTBOOK : Fundamentalsof Database System (PEARSON) 2. TEXTBOOK : Database System Concepts (McGraw-Hill Education) 2. NOTEBOOK : PROF. PABITRA ROY 3. WEBSITE : www.google.com 4. www.youtube.com 5. nptel.ac.in 34