enhanced er(database)
DESCRIPTION
TRANSCRIPT
![Page 1: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/1.jpg)
Lecture 4: Enhanced E-R Model
ISOM3260, Spring 2014
![Page 2: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/2.jpg)
2
Where we are now• Database environment
– Introduction to database• Database development process
– steps to develop a database• Conceptual data modeling
– entity-relationship (ER) diagram; enhanced ER• Logical database design
– transforming ER diagram into relations; normalization• Physical database design
– technical specifications of the database• Database implementation
– Structured Query Language (SQL), Advanced SQL• Advanced topics
– data and database administration
![Page 3: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/3.jpg)
3
Database development activities during SDLC
Top-downanalysis
![Page 4: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/4.jpg)
4
Why Enhanced E-R Model?
• Business data are now more complex• EER improve flexibility of the basic E-R
model to represent business data• EER is the result of extending the original
E-R model with new modeling constructs
![Page 5: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/5.jpg)
5
Enhanced E-R Model
• Supertype and subtype• Generalization and specialization• Specifying constraints in supertype/subtype
relationships• Supertype/subtype hierarchy• Entity clustering
![Page 6: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/6.jpg)
6
Supertypes and Subtypes• Subtype
– a subgrouping of the entities in an entity type, that is meaningful to the organization, and which has attributes or relationships that are distinct from those in other subgroupings
– at the same time, the subgroupings share common attributes which are associated with the entity type
– e.g. GRADUATE STUDENT and UNDERGRADUATE STUDENT subtypes of STUDENT
![Page 7: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/7.jpg)
7
Supertypes and Subtypes• Supertype
– a generic entity type that has a relationship with one or more subtypes
– e.g. STUDENT supertype of GRADUATE STUDENT and UNDERGRADUATE STUDENT
• Attribute Inheritance– subtype entities inherit values of all attributes
of the supertype– an instance of a subtype is also an instance of
the supertype
![Page 8: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/8.jpg)
8
Figure 3-1: Basic notation for supertype/subtype relationships
![Page 9: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/9.jpg)
9
Figure 3-2: Employee supertype with three subtypes
All subtypes will have Employee_Number, Employee_Name, Address, and Date_Hired
Each subtype will also have its own attributes
![Page 10: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/10.jpg)
10
Supertype/Subtype Relationships
• Relationships at the supertype level – indicate that all subtypes will participate in the
relationship
• Relationships at the subtype level – the instances of a subtype may participate in a
relationship unique to that subtype
![Page 11: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/11.jpg)
11
Figure 3-3: Supertype/subtype relationships in a hospital
Both outpatients and resident patients are cared for by a responsible physician
Only resident patients are assigned to a bed
![Page 12: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/12.jpg)
12
Generalization and Specialization
• Two processes to develop supertype/subtype relationships
• Generalization– the process of defining a more general entity type from a
set of more specialized entity types– bottom-up process
• Specialization– the process of defining one or more subtypes of the
supertype, and forming supertype/subtype relationships– top-down process
![Page 13: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/13.jpg)
13
Figure 3-4a: Example of generalization
Three entity types: CAR, TRUCK, and MOTORCYCLE
All these types of vehicles have common attributes
![Page 14: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/14.jpg)
14
Figure 3-4b: Generalization to VEHICLE supertype
So we put the shared
attributes in a supertype
No subtype for motorcycle, since it has no unique attributes
![Page 15: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/15.jpg)
15
Figure 3-5a: Example of specialization
Applies only to manufactured
parts
Applies only to purchased parts
Parts may be manufactured internally and/or purchased from suppliers
![Page 16: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/16.jpg)
16
Figure 3-5b: Specialization to MANUFACTURED PART and PURCHASED PART
Multivalued attribute “supplier” was replaced by a relationship to another entity
Created 2 subtypes
![Page 17: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/17.jpg)
17
Completeness Constraints in Supertype/Subtype Relationships
• Completeness Constraint– whether an instance of a supertype must also
be a member of at least one subtype
• Total Specialization Rule– Yes (double line)
• Partial Specialization Rule– No (single line)
![Page 18: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/18.jpg)
18
Figure 3-6: Examples of completeness constraints
(a) Total specialization rule
A patient must be either an outpatient or a resident patient
![Page 19: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/19.jpg)
19
Figure 3-6b: Partial specialization rule
A vehicle could be a car, a truck, or neither
![Page 20: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/20.jpg)
20
Disjointness Constraints in Supertype/Subtype Relationships
• Disjointness Constraint– whether an instance of a supertype may simultaneously be a
member of two or more subtypes• Disjoint Rule
– No (letter ‘d’)– an instance of the supertype can be only ONE of the subtypes
• Overlap Rule– Yes (letter ‘o’)– an instance of the supertype can simultaneously be a member
of two or more subtypes
![Page 21: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/21.jpg)
21
(a) Disjoint rule
Figure 3-7: Examples of disjointness constraints
A patient can either be outpatient or resident, but not both, at any given time
![Page 22: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/22.jpg)
22
Figure 3-7b: Overlap rule
A part may be both purchased and manufactured
![Page 23: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/23.jpg)
23
Subtype Discriminators• A mechanism to implement supertype/subtype
relationships• Subtype Discriminator
– an attribute of the supertype whose values determine the target subtype(s)
• Disjoint subtype– a simple attribute with alternative values to indicate the
possible subtypes• Overlapping subtype
– a composite attribute whose subparts pertain to different subtypes
– each subpart contains a boolean value (‘Y’ or ‘N’) to indicate whether or not the instance belongs to the associated subtype
![Page 24: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/24.jpg)
24
Figure 3-8: Introducing a subtype discriminator (disjoint rule)
A simple attribute with different possible values indicating the subtype
![Page 25: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/25.jpg)
25
Figure 3-9: Subtype discriminator (overlap rule)
A composite attribute with sub-attributes indicating “Y” or “N” to determine whether it is of each subtype
![Page 26: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/26.jpg)
26
Supertype/Subtype Hierarchies
• Attributes are assigned at the highest logical level in the hierarchy– e.g. SSN applies to all PERSONs– e.g. Date_Hired applies only to EMPLOYEE
• Subtypes lower in the hierarchy inherit attributes from their supertypes up to the root (entity type at top of hierarchy)– e.g. an instance of FACULTY has the following attributes:– SSN, Name, Address, Gender, Date_of_Birth (from
PERSON)– Date_Hired, Salary (from EMPLOYEE)– Rank (from FACULTY)
![Page 27: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/27.jpg)
27
Figure 3-10: Example of supertype/subtype hierarchy
![Page 28: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/28.jpg)
28
Entity Clusters
• EER diagrams are difficult to read when there are too many entities and relationships
• Different people may be interested in different types of data
• Solution– group entities and relationships into entity clusters
• Entity cluster– a set of one or more entity types and associated
relationships grouped into a single abstract entity type
![Page 29: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/29.jpg)
29
Figure 3-13a: Possible entity clusters for Pine Valley Furniture
Related groups of entities can become clusters
![Page 30: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/30.jpg)
30
Figure 3-13b: EER diagram of entity clusters
More readable, isn’t it?
![Page 31: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/31.jpg)
31
Figure: ER model for class scheduling
![Page 32: Enhanced ER(database)](https://reader035.vdocuments.net/reader035/viewer/2022081414/54c861104a7959fd7e8b45c1/html5/thumbnails/32.jpg)
32
Review Questions
• What are subtypes and supertypes?• What are generalization and specialization?• What are the total and partial specialization
rules?• What are the disjoint and overlap rules?• What are subtype discriminators?• What are supertype/subtype hierarchies?• What are entity clusters?