Download presentation
Presentation is loading. Please wait.
Published byLewis Pitts Modified over 9 years ago
1
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to- Relational Mapping Lecture # 20 August 4,2012
2
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Review of ER-to-Relational Mapping Algorithm We present the concepts of a general mapping algorithm Algorithm has 7 steps: –Step 1: Mapping of regular (strong) entity types –Step 2: Mapping of weak (dependent) entity types –Steps 3, 4, 5: Mapping of binary relationship types of different cardinality ratios (1:1, 1:N, M:N) –Step 6: Mapping of multi-valued attributes –Step 7: Mapping of n-ary relationship types, n > 2 Example: We use the COMPANY ER schema diagram (Figure 9.1, next slide) to illustrate the mapping steps Additional steps (Steps 8, 9) for mapping EER model constructs (specialization/generalization, UNION types) presented later
3
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
7
EER To Relational Mappings Mapping of Specialization or Generalization Step 8: Options for Mapping Specialization or Generalization. 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.
8
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley EER To Relational Mappings Mapping of Specialization or Generalization Step 8: Options for Mapping Specialization or Generalization. Option 8A: Suitable for Total, Partial Disjoint or Overlapping Option 8B: Recommended only for disjoint Option 8C: Works only for disjoint Option 8D:Works for specializations whose subclasses are overlapping.
9
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley EER To Relational Mappings Mapping of Specialization or Generalization Step 8: Options for Mapping Specialization or Generalization. Options 8A and 8B can be called the multiple-relation options. 8C and 8D can be called the single-relation options
10
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley EER Model Example
11
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley EER Model Example
12
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley EER Model Example
13
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Example
14
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Another Example
15
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley EER To Relational Mappings Mapping of Union Types Step 9: Mapping of Union Types (Categories). For mapping a category whose defining super classes have different keys, it is customary to specify a new key attribute, called a surrogate key, when creating a relation to correspond to the category.
16
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Union Type-Example
17
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley In-Class Exercises Apply the ER-to-Relational Mapping Algorithm to the SHIP_TRACKING ER Schema in Figure 9.8 (next slide)
18
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.