0% found this document useful (0 votes)
38 views32 pages

Eerd 2

The document discusses enhanced entity relationship (EER) modeling. It describes key concepts in EER including subclasses and superclasses, generalization and specialization, constraints on subclasses, and provides examples of applying these concepts when modeling entities and their relationships.

Uploaded by

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

Eerd 2

The document discusses enhanced entity relationship (EER) modeling. It describes key concepts in EER including subclasses and superclasses, generalization and specialization, constraints on subclasses, and provides examples of applying these concepts when modeling entities and their relationships.

Uploaded by

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

Database Systems

ENTITY RELATIONSHIP MODEL


TAI LA JAB E E N
Enhanced Entity Relation
Diagram
CHAPTER# 3

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

• SalariedEmployee, Hourly Employee, Manager,


Secretary, Engineer, and Technician are considered
subclasses of “Employee”.
• “Employee” is the superclass of all the previous
types of employees.
• We have a set of subclass/superclass connections
– Example: Manager/Employee – Example:
Secretary/Employee
8
Subclasses, Superclasses, and Inheritance
• The connection between subclass and superclass is
called inheritance.
• A subclass inherits all attributes of its superclass.
• Example: Employee has a name, address, and
birth_date.
• Each subclass of Employee such as manager, secretary,
… etc has also name, address, and birth_date which
they inherit from the superclass Employee.
9
Subclasses, Superclasses, and Inheritance

• A subclass inherits all relationships of its


superclass – Example: Employee
“works_for” Department – All subclasses
such as Manager, Secretary, … etc also
“work_for” Department.

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

• Total or Partial – A sub-classing relationship is total if every super-class entity


is to be associated with some sub-class entity, otherwise partial.
• Overlapped or Disjoint – If an entity from super-set can be related (can
occur) in multiple sub-class sets, then it is overlapped sub-classing, otherwise
disjoint.
• Note – These constraints are independent of each other: can be “overlapped
and total or partial” or “disjoint and total or partial”. Also sub-classing has
transitive property.
25
Disjoint Constraint

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

You might also like