Database Management System
Lecture 05
By Hemant Tulsani
Assistant Professor
ECE Department
Department of Electronics and Communication Engineering 1
Maharaja Agrasen Institute of Technology
Till now we have covered…
• Entity and Entity Set
• Relationship Sets
• Mapping Cardinalities
• Attributes
• Weak Entity Sets
Department of Electronics and Communication Engineering 2
Maharaja Agrasen Institute of Technology
In this lecture...
• ER Diagram
• Design Issues
• Extended E-R Features
• Reduction to Relation Schemas
Department of Electronics and Communication Engineering 3
Maharaja Agrasen Institute of Technology
E-R Diagrams
• Rectangles represent entity sets.
• Diamonds represent relationship sets.
• Lines link attributes to entity sets and entity sets to relationship sets.
• Ellipses represent attributes
• Double ellipses represent multivalued attributes.
• Dashed ellipses denote derived attributes.
• Underline indicates primary key attributes (will study later)
E-R Diagram With Composite, Multivalued, and Derived Attributes
Relationship Sets with Attributes
Roles
• Entity sets of a relationship need not be distinct
• The labels “manager” and “worker” are called roles; they specify how employee
entities interact via the works_for relationship set.
• Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to
rectangles.
• Role labels are optional,
and are used to clarify
semantics of the
relationship
Cardinality Constraints
• We express cardinality constraints by drawing either a directed line (), signifying
“one,” or an undirected line (—), signifying “many,” between the relationship set
and the entity set.
• One-to-one relationship:
– A customer is associated with at most one loan via the relationship borrower
– A loan is associated with at most one customer via borrower
Cardinality Constraints
• In the one-to-many relationship a loan is associated with at most one
customer via borrower, a customer is associated with several
(including 0) loans via borrower
Cardinality Constraints
• In a many-to-one relationship a loan is associated with several
(including 0) customers via borrower, a customer is associated with at
most one loan via borrower
Cardinality Constraints
Many-to-many relationship
• A customer is associated with several (possibly 0) loans via borrower
• A loan is associated with several (possibly 0) customers via borrower
Participation of an Entity Set in a
Relationship Set
Total participation (indicated by double line): every entity in the entity set
participates in at least one relationship in the relationship set
E.g. participation of loan in borrower is total (every loan must have a customer
associated to it via borrower)
Partial participation: some
entities may not participate in
any relationship in the
relationship set
Example: participation of
customer in borrower is
partial
E-R Diagram with a Ternary Relationship
Alternative E-R Notations
Alternative E-R Notations
Design Issues
• Use of entity sets vs. attributes
Choice mainly depends on the structure of the enterprise being modeled, and on the
semantics associated with the attribute in question.
Design Issues
• Use of entity sets vs. relationship sets
Possible guideline is to designate a relationship set to
describe an action that occurs between entities
Design Issues
• Binary versus n-ary relationship sets
Although it is possible to replace any nonbinary (n-ary, for n > 2) relationship set by
a number of distinct binary relationship sets, a n-ary relationship set shows more
clearly that several entities participate in a single relationship.
Design Issues
• Placement of relationship attributes
Attributes of one-to-one or one-to-many relationship sets can be associated with one
of the participating entity sets, rather than with the relationship set.
• Attributes of a one-to-many relationship set can be repositioned to only the entity
set on the “many” side of the relationship.
• For one-to-one relationship sets, on the other hand, the relationship attribute can be
associated with either one of the participating entities.
Design Issues
• Placement of relationship attributes
Extended E-R Features: Specialization
• Top-down design process; we designate sub-groupings within an entity set that
are distinctive from other entities in the set.
• These sub-groupings become lower-level entity sets that have attributes or
participate in relationships that do not apply to the higher-level entity set.
• Depicted by a triangle component labeled ISA (E.g. customer “is a” person).
• Attribute inheritance – a lower-level entity set inherits all the attributes and
relationship participation of the higher-level entity set to which it is linked.
Specialization Example
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.
Specialization and Generalization (Cont.)
• Can have multiple specializations of an entity set based on different features.
• E.g. permanent_employee vs. temporary_employee, in addition to officer vs.
secretary vs. teller
• Each particular employee would be
– a member of one of permanent_employee or temporary_employee,
– and also a member of one of officer, secretary, or teller
• The ISA relationship also referred to as superclass - subclass relationship
Aggregation
• Abstraction through which relationships are
treated as higher-level entities.
• 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
Aggregation (Cont.)
• 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
E-R Diagram With Aggregation
Summary of Symbols
Summary of Symbols