EER
Dr. Jenila Livingston L.M.
SCSE
1
Extended ER features
Specialization and Generalization – Inheritance
Aggregation
2
Specialization and Generalization
An Example:
Customers can have checking and savings accts
Checking ~ Savings (many of the same attributes)
Old Way:
Customer Has1 Savings Acct
acct_no balance interest
Has2 Checking Acct
acct_no balance overdraft
3
Specialization and Generalization
An Example:
Customers can have checking and savings accts
Checking ~ Savings (many of the same attributes)
New Way (Using ER
acct_no balance
Extended features):
Customer Has Account superclass
Isa
Savings Acct Checking Acct
interest overdraft
subclasses
4
Specialization and
Generalization - Inheritance
5
Specialization and
Generalization – UMI Notation
In terms of an E-R diagram, specialization is depicted by a hollow arrow-
head pointing from the specialized entity to the other entity
person
ID
name
address
customer
employee
credit-rating
salary
officer teller secretary
office-number station-number hours-worked
hours-worked
6
Specialization and
Generalization -Chen Notation
7
Specialization
Inheritance relationships also referred to as a superclass-subclass relationships.
Lower-level entity sets:
Have attributes that do not apply to the higher-level entity set.
Participate in relationships that do not apply to the higher-level entity set, e.g.,
airline employees, pilots, crew, agents, etc., but only pilots are certified
certified to fly certain aircraft types.
Attribute inheritance – Lower-level entity sets are said to inherit all the
attributes and relationships from the higher-level entity sets to which they are
linked.
8
Specialization vs. Generalization
Top-down design process (Specialization); we designate sub-
groupings within an entity set that are distinctive from other
entities in the set.
Bottom-up design process (Generalization): combine a
number of entity sets that share the same features into a higher-
level entity set.
The terms specialization and generalization are used
interchangeably, for the obvious reasons.
9
Specialization
and Generalization, Cont.
A specialization/generalization relationship can
be:
User Defined vs Condition Defined
disjoint vs. overlapping
total vs. partial
10
Specialization and Generalization
Subclass Distinctions:
1. User-Defined vs. Condition-Defined
User: Membership in subclasses explicitly determined
(e.g., Person, Student, Teacher)
Condition: Membership predicate associated with
subclasses - e.g: given below
Person
Isa
Child Adult Senior
age < 18 age 18 age 65
11
Specialization and Generalization
Subclass Distinctions:
2. Overlapping vs. Disjoint
Overlapping: Entities can belong to >1 entity set
(e.g., Adult, Senior)
Disjoint: Entities belong to exactly 1 entity set
(e.g., Child)
Person
Isa
Disjoint
Child Adult Senior
age < 18 age 18 age 65
12
Specialization and Generalization
Subclass Distinctions:
3. Total vs. Partial Membership
Total: Every entity of superclass belongs to a subclass
Person
Isa
Child Adult Senior
age < 18 age 18 age 65
Partial: Some entities of super class do not belong to any
subclass (e.g., if Adults condition is age 21, some entities are not
belonging to any subclass )
13
Specialization and Generalization
Subclass Distinctions:
3. Total vs. Partial Membership
Total: Every entity of superclass belongs to a subclass
Person
Isa
Child Adult Senior
age < 18 age 21 age 65
Partial: Some entities of super class do not belong to any
subclass (e.g., if Adults condition is age 21, (19,20) which is not
belonging to any subclass )
14
Aggregation
E/R: No relationships between relationships
E.g.: Associate loan officers with Borrows relationship set
Customer Borrows Loan
?
Loan_Officer
Employee
Associate Loan Officer with Loan?
What if we want a loan officer for every (customer, loan) pair?
15
Aggregation - Binary
E/R: No relationships between relationships
E.g.: Associate loan officers with Borrows relationship set
Customer Borrows Loan
Loan_Officer
Employee
Associate Loan Officer with Borrows?
Must First Aggregate
16
Aggregation
17
E-R Diagram for a Banking
Enterprise (Chen’s Notation)
18
E-R Diagram
for the Banking Enterprise
branch
account branch-name
account-branch
account-number Branch-city
balance assets
depositor loan-branch
customer loan
customer- name borrower loan-number
customer-street amount
customer-city
19
E-R Diagram
for a University
20
Lets Try an Example!
Construct an ER diagram for a car insurance company whose customers own
one or more cars each. Each car has associated with it zero to any number of
recorded accidents.
21
Lets Try an Example!
From the 6th edition…
Construct an ER diagram for a car insurance company whose customers own
one or more cars each. Each car has associated with it zero to any number of
recorded accidents. Each insurance policy covers one or more cars, and has
one or more premium payments associated with it. Each payment is for a
particular period of time, and has an associated due date, and the date when
the payment was received.
22
Thank You!
23