Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

CHAPTER 9

Part02

Relational Database Design by ER- and


EERR-to-Relational Mapping

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 1


ER-to-Relational Mapping Algorithm
(contd.)
◼ Step 7: Mapping of N-ary Relationship Types.
◼ N+1 relations approach: similar to 3-relations
approach
◼ For each n-ary relationship type, create a new
relation
◼ Include as FK attributes the PKs of the relations
that represent the participating entity types.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 2



Mapping the n-ary relationship type SUPPLY

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 3


Mapping EER Model Constructs to
Relations
◼ Step8: Options for Mapping Specialization or
Generalization
◼ m specialization subclasses {S1, S2,….,Sm} and the
generalized superclass C
◼ Option 8A: Multiple relations-Superclass and

subclasses
◼ Option 8B: Multiple relations-Subclass relations only

◼ Option 8C: Single relation with one type attribute

◼ Option 8D: Single relation with multiple type


attributes

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 4


FIGURE 4.4
EER diagram notation for an attribute-defined
specialization on JobType.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 5


Mapping EER Model Constructs to
Relations
◼ Option 8A: Multiple relations-Superclass and
subclasses
◼ Create a relation for each subclass and the
superclass
◼ The PK attribute of superclass relation will be
present in the subclass relations and will be PK as
well as FK

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 6


Mapping EER Model Constructs to
Relations
◼ Option 8B: Multiple relations-Subclass relations
only
◼ No relation for superclass, only for subclasses
◼ Superclass attributes added to subclass relations
◼ Only works for a specialization whose subclasses
are total i.e. every entity in the superclass must
belong to (at least) one of the subclasses

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 7


Mapping EER Model Constructs to
Relations (contd.)
◼ Option 8C: Single relation with one type attribute
◼ Only one relation containing attributes of
superclass and all subclasses
◼ One type attribute to indicate the subclass type

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 8


Mapping EER Model Constructs to
Relations (contd.)
◼ Option 8D: Single relation with multiple type
attributes
◼ When an entity can belong to multiple subclasses
◼ Only one relation containing attributes of
superclass and all subclasses
◼ m Boolean type attributes to indicate entity type

IsSec IsTech IsEng

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 9- 9

You might also like