Eerd 2
Eerd 2
2
Enhanced ER Diagram (EER)
• It is Enhanced ER Diagram (EER) or
• It is Extended ER Diagram (EER).
• It is an ER diagram + enhancement.
• Some times EER diagram is called E2R Diagram.
3
Enhanced Entity Relation Model
• It is a diagrammatic technique for displaying the
following concepts
• Sub Class and Super Class
• Specialization and Generalization
• Constraints
• Aggregation
4
Subtype and Supertype Entities
• An entity that contains some optional attributes or subtypes is called a super
entity.
• Example
• an entity CUSTOMER has the attributes CustomerlD Address and Phone.
• A customer can be an individual or an organization.
• The following additional information is required to be stored about the customer
depending on the type of the customer:
• For Individual: NIC, Profession, Destination
• For Organization: RegistrationID, ContactPerson, TaxID
5
Subtype and Supertype Entities
• If the customer is an individual, RegistrationID, ContactPerson and TaxID
are not used.
• If the customer is an organization, NIC, Profession and Designation are not
used.
• The second way to manage this situation is to use subtypyes follows:
6
Subtype and Supertype Entities
For example: Shape super class is having sub groups as Square, Circle,
Triangle.
For example: Square, Circle, Triangle are the sub class of Shape super class.
7
Subclasses, Superclasses, and Inheritance
Example
10
Subclasses, Superclasses, and Inheritance
• We classify an entity type into subclasses because
each subclass has its own unique attributes.
• Example: –
• Secretary has “typing_speed” attribute.
• Salaried_Employee has “salary” attribute.
• Hourly Employee has “payScale” attribute.
• Engineer has “eng_type” attribute.
• Technician has “Tech_grade” attribute.
11
13
14
Generalization vs
Specialization
15
Generalization and Specialization
16
Specialization
• The process of defining subclasses of an entity type is called
specialization. Or Specialization is a process of identifying more
specific entity types.
• For example,
• STUDENT and LAWYER are more specific entity types than HUMAN.
17
Generalization
• Generalization is the reverse process of specialization.
• Generalization is a process of identifying more general entity
types.
• If you find a set of classes with many common attributes, they can
be considered subclasses and generalized to a common entity
(superclass).
• For example,
• HUMAN is a more general entity type than STUDENT or LAWYER. The
entity type HUMAN contains attributes that are more general than other
two entity types. It may contain the attributes like NAME, ADDRESS and
AGE etc. me entity type STUDENT contain, the attributes which are
specific to students like ROLL NO, MARKS and GRADE etc.
18
Generalization and Specialization
20
Generalization and Specialization
• Specialized class are often called as subclass while generalized
class are called superclass, probably inspired by object oriented
programming. A sub-class is best understood by “IS-A analysis”.
• Following statements hopefully makes some sense to your mind
“Technician IS-A Employee”, “Laptop IS-A Computer”.
• An entity is specialized type/class of other entity. For example,
Technician is special Employee in a university system Faculty is
special class of Employee.
• In the example here Employee is generalized entity class while
Technician and Faculty are specialized class of Employee.
21
Example, in an ER diagram you might have two entity
types: – Car – Truck
How can we generalize this?
22
The common attributes go to the superclass and the
current entity types (Car and Truck) become
subclasses.
23
Constraints
• Constraints – There are two types of constraints on “Sub-class” relationship.
• Total or Partial
• Overlapped or Disjoint
26
Overlapping Constaints
27
EERD Examples
28
29
Note
• Disjointness and Completeness constraints are
independent, so you might have the following
combinations of specializations:
• – Disjoint, total
• – Disjoint, partial
• – Overlapping, total
• – Overlapping, partial
30
Exercise - 1
• An organization depends on a number of different types of persons for its
successful operation. People within the organization are characterized by
the following: SSN, Full Name (composed of First name and Last name),
Address, and Phone Number. A person may have one or more addresses
and phone numbers. Only three types of people are of greatest interest:
employees, volunteers, and donors. Employees have a start date, and a
salary. Volunteers have skill attribute. Donors only have a relationship with
an item that has an item id. An item can be money (which has an attribute
called amount), clothes (which has a size attribute), or furniture. No other
types of items are considered. A donor must have donated one or more
items, and an item may have no donor, or one donor. At a given time, a
person may belong to one or more of these groups.
• Draw an EER diagram based on the requirements above. Write down
assumption (if any) you make in your answer.
31
32
Corrections:
Cardinality at Donor 0 or 1.
33
34
Reading Assignment and Practice Link
• http://faculty.juniata.edu/rhodes/dbms/eermodel.html
• http://tinman.cs.gsu.edu/~raj/4710/f11/Ch08.pdf
35