Docsity

Database Hoeffer chapter 03, Lecture notes of Database Programming

Partial preview of the text

Download Database Hoeffer chapter 03 and more Lecture notes Database Programming in PDF only on Docsity!

CHAPTER 3:CHAPTER 3:

THE ENHANCED E-R MODEL THE ENHANCED E-R MODEL

© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Modern Database Management

th

Edition

Jeffrey A. Hoffer, V. Ramesh, Heikki Topi

Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

OBJECTIVES OBJECTIVES

 (^) Define termsDefine terms  Understand use of supertype/subtype relationshipsUnderstand use of supertype/subtype relationships  Understand use of specialization andUnderstand use of specialization and generalization techniques generalization techniques  Specify completeness and disjointness constraintsSpecify completeness and disjointness constraints  (^) Develop supertype/subtype hierarchies for realisticDevelop supertype/subtype hierarchies for realistic business situations business situations  Develop entity clustersDevelop entity clusters  (^) Explain universal (packaged) data modelExplain universal (packaged) data model  Describe special features of data modeling projectDescribe special features of data modeling project using packaged data model using packaged data model

Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

SUPERTYPES AND SUBTYPES SUPERTYPES AND SUBTYPES

Enhanced ER model:Enhanced ER model: extends original ER modelextends original ER model

with new modeling constructs with new modeling constructs 

Subtype:Subtype: A subgrouping of the entities in an entityA subgrouping of the entities in an entity

type that has attributes distinct from those in other type that has attributes distinct from those in other subgroupings subgroupings 

Supertype:Supertype: A generic entity type that has aA generic entity type that has a

relationship with one or more subtypes relationship with one or more subtypes 

Attribute Inheritance:Attribute Inheritance:

 (^) Subtype entities inherit values of all attributes of theSubtype entities inherit values of all attributes of the supertype supertype  (^) An instance of a subtype is also an instance of theAn instance of a subtype is also an instance of the supertype supertype

Figure 3-1 Basic notation for supertype/subtype notation a) EER notatio n Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Figure 3-2 Employee supertype with three subtypes All employee subtypes will have employee number, name, address, and date hired Each employee subtype will also have its own attributes Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

RELATIONSHIPS AND SUBTYPES RELATIONSHIPS AND SUBTYPES

Relationships at theRelationships at the supertypesupertype levellevel

indicate that all subtypes will indicate that all subtypes will

participate in the relationship participate in the relationship

The instances of aThe instances of a subtypesubtype maymay

participate in a relationship unique to participate in a relationship unique to

that subtype. that subtype. In this situation, theIn this situation, the

relationship is shown at the subtype relationship is shown at the subtype

level level

Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

 The property by which subtype entities

inherit values of all attributes of the

supertype.

 This important property makes it

unnecessary to include supertype

attributes redundantly with the

subtypes.

Figure 3-3 Supertype/subtype relationships in a hospital Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Figure 3-4 Example of generalization a) Three entity types: CAR, TRUCK, and MOTORCYCLE All these types of vehicles have common attributes Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Figure 3-4 Example of generalization (cont.) So we put the shared attributes in a supertype Note: no subtype for motorcycle, since it has no unique attributes b) Generalization to VEHICLE supertype Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

b) Specialization to MANUFACTURED PART and PURCHASED PART Note: multivalued composite attribute was replaced by an associative entity relationship to another entity Created 2 subtypes Figure 3-5 Example of specialization (cont.) Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Completeness Constraints: 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)

b) Partial specialization rule Figure 3-6 Examples of completeness constraints (cont.) Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall

 Disjointness Constraints: Whether an

instance of a supertype may

simultaneously be a member of two (or

more) subtypes

 (^) Disjoint Rule: An instance of the supertype can be only ONE of the subtypes  (^) Overlap Rule: An instance of the supertype could be more than one of the subtypes Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall© 2013 Pearson Education, Inc. Publishing as Prentice Hall