Unit 2.3
Unit 2.3
Saving_Account Current_Account
Sub Class
2
Section - 7
Generalization v/s Specialization
Generalization Specialization
It extracts the common features of multiple It splits an entity to form multiple new entities
entities to form a new entity. that inherit some feature of the splitting entity.
Name Address Name Address
SPI Salary
Person Person
Name Name
ISA
Address Address
Top-down approach
Bottom-up approach
4
Generalization v/s Specialization
Generalization Specialization
The process of creation of group from various The process of creation of sub-groups within
entities is called generalization. an entity is called specialization.
It is Bottom-up approach. It is Top-down approach.
The process of taking the union of two or more The process of taking a sub set of higher level
lower level entity sets to produce a higher level entity set to form a lower level entity set.
entity set.
It starts from the number of entity sets and It starts from a single entity set and creates
creates high level entity set using some different low level entity sets using some
common features. different features.
5
Generalization & Specialization example
Name Address
PID City
Person
ISA
ISA
6
Exercise
Give the examples of Generalization/Specialization in the following E-R diagram:
Hospital Management System.
College Management System.
Bank Management System.
Insurance Company.
7
Section - 8
Constraints on Specialization and Generalization
Constraints
Disjoint Participation
9
Disjoint Constraint
It describes relationship between members of the superclass and subclass and indicates
whether member of a superclass can be a member of one, or more than one subclass.
Types of disjoint constraints
Disjoint Constraint
Non-disjoint (Overlapping) Constraint
10
Disjoint Constraint
It specifies that the entity of a super class can belong to only one lower-level entity set (sub
class).
Specified by ‘d’ or by writing disjoint near to the ISA triangle.
Employee
Cricketer (Super class)
(Super class)
Disjoint
Batsman Bowler ISA
(Sub class) (Sub class)
Full-time Part-time
(Sub class) (Sub class)
All the players are associated with only one sub class either (Batsman or Bowler).
11
Non-disjoint (Overlapping) Constraint
It specifies that an entity of a super class can belong to more than one lower-level entity set
(sub class).
Specified by ‘o’ or by writing overlapping near to the ISA triangle.
Employee
Cricketer (Super class)
(Super class)
Non-disjoint
Batsman Bowler ISA
(Sub class) (Sub class)
Faculty Head
(Sub class) (Sub class)
One player (Yuvraj singh) is associated with more than one sub class.
12
Constraints on Specialization and Generalization
Constraints
Disjoint Participation
13
Participation (Completeness) Constraint
It determines whether every member of super class must participate as a member of subclass
or not.
Types of participation (Completeness) Constraint
Total (Mandatory) participation
Partial (Optional) participation
14
Total (Mandatory) Participation
Total participation specifies that every entity in the superclass must be a member of some
subclass in the specialization.
Specified by a double line in E-R diagram.
Employee
Cricketer (Super class)
(Super class)
Professor Head
(Sub class) (Sub class)
All the players are associated with minimum one sub class either (Batsman or Bowler).
15
Partial (Optional) Participation
Partial participation specifies that every entity in the super class does not belong to any of the
subclass of specialization.
Specified by a single line in E-R diagram.
Employee
Cricketer (Super class)
(Super class)
Professor Head
(Sub class) (Sub class)
16
Section - 9
Limitation of E-R diagram
In E-R model we cannot express relationships between two relationships.
18
Limitation of E-R diagram
Customer
Company
Borrow Borrow
Loan Loan
19
Section - 10
E-R diagram of Hospital Management System
MRID
PatID Name HosID Name
Indoor Outdoor
Doctor
RoomNo
IPDID OPDID DrID Dr Name
Charge
21
Section - 11
Reduce the E-R diagram to database schema
23
Reduce the E-R diagram to database schema
PhoneNo (T2)
24
Reduce the E-R diagram to database schema
WifeID WName
Step 3: Reduce 1:1 Mapping Cardinality:
25
Reduce the E-R diagram to database schema
HouseID HName
Step 4: Reduce 1:N Mapping Cardinality:
26
Reduce the E-R diagram to database schema
ActNo Balance
Step 5: Reduce N:N Mapping Cardinality:
27
Summery of Symbols used in E-R diagram
28
Summery of Symbols used in E-R diagram
Disjoint
E R E ISA ISA
One to One Total Disjoint
Specialization/ Specialization/
E R E Generalization Generalization
One to Many
E R E Overlapping
29