ER/EER to Relational Mapping Chapter 9. STEP 1 ENTITY TYPE E (non weak) -> NEW RELATION T RELATION T: – includes all simple attributes (non composite,

Slides:



Advertisements
Similar presentations
3/25/2017.
Advertisements

Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Relational Database Design Via ER Modelling
Mapping ER to Relational Model
Database technology Lecture 4: Mapping of EER model to relations Jose M. Peña
1 Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – EER Model –21th June.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 7- 1.
Chapter 6 Methodology Logical Database Design for the Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
Methodology Logical Database Design for the Relational Model
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- Mapping.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to- Relational Mapping.
Database Systems Chapter 7 ITM 354. Chapter Outline ER-to-Relational Schema Mapping Algorithm –Step 1: Mapping of Regular Entity Types –Step 2: Mapping.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to- Relational Mapping.
Summary of Mapping constructs and constraints
Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Database Systems ER and EER to Relational Mapping Toqir Ahmad Rana Database Management Systems 1 Lecture 18.
Enhanced Entity-Relationship Model (EER) 1. Enhanced-ER (EER) Model Concepts Includes all modeling concepts of basic ER Additional concepts: subclasses/superclasses,
Dr. Bernard Chen Ph.D. University of Central Arkansas
Chapter 91 ER & EER to Relational Mapping. Chapter 92 ER to Relational Mapping Step 1: For each regular entity type E in the ER schema, create a relation.
1 CSE 480: Database Systems Lecture 8: EER to Relational Mapping and DBDesigner Reference: Read Chapter 9 of the textbook.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to-Relational Mapping.
ER- and EER-to-Relational Mapping
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008
Relational Database Design by ER- and EER-to-Relational Mapping
Chapter 21 B Mapping to ODL Copyright © 2004 Pearson Education, Inc.
Relational Database Design by ER- and EER-to- Relational Mapping
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design by ER to Relational Mapping by Pinar Senkul resources: mostly.
Slide Chapter 7 Relational Database Design by ER- to-Relational Mapping.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
1 Chapter 17 Methodology - Local Logical Database Design.
Relational Database Design by ER- and EERR-to-Relational Mapping.
Chapter 6 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Relational Database Design by ER- and EER-to-Relational Mapping The main reference of this presentation is the textbook and PPT from : Elmasri & Navathe,
DatabaseIM ISU1 Chapter 7 ER- and EER-to-Relational Mapping Fundamentals of Database Systems.
ER-TO-RELATIONAL MODEL MAPPING CONTENT SOURCES: ELAMSARI AND NAVATHE, FUNDAMENTALS OF DATABASE MANAGEMENT SYSTEMS.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 9 Relational Database Design by ER- and EERR-to-Relational Mapping Slide 9- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
ER- Relational Mapping (Based on Chapter 9 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Relational Database Design by ER- and EER-to-Relational Mapping
Relational Database Design by ER- and EER-to-Relational Mapping
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping.
Methodology - Logical Database Design. 2 Step 2 Build and Validate Local Logical Data Model To build a local logical data model from a local conceptual.
Translation of EER model into relational model Jose M. Peña
Databases (CS507) CHAPTER 8
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Relational Database Design by ER- and ERR-to-Relational Mapping
Relational Database Design by ER- and EER-to- Relational Mapping
Methodology Logical Database Design for the Relational Model
Relational Database Design by ER- and EER-to- Relational Mapping
EER Model – Chapter
Enhanced Entity-Relationship (EER) Modeling
Relational Database Design by ER- and EER-to-Relational Mapping
ER- and EER-to-Relational
9/5/2018.
11/15/2018.
Chapter 8: Mapping a Conceptual Design into a Logical Design
Relational Database Design by ER- and EER-to-Relational Mapping
Session 2 Welcome: The seventh learning sequence
EER to Relational Mapping
Relational Database Design by ER- and EER-to-Relational Mapping
Relational Database Design by ER- and EER-to- Relational Mapping
ER to Relational Mapping
Relational Database Design by ER- and EERR-to-Relational Mapping
4/11/2019.
Relational Database Design by ER- and EER-to-Relational Mapping
CS4222 Principles of Database System
7/19/2019.
Presentation transcript:

ER/EER to Relational Mapping Chapter 9

STEP 1 ENTITY TYPE E (non weak) -> NEW RELATION T RELATION T: – includes all simple attributes (non composite, single-valued) from E – includes only simple component attributes of a composite attribute from E (they are on their own now) – we choose a primary key for T

STEP 2 WEAK ENTITY TYPE W -> NEW RELATION T (with owner entity set E) RELATION T: – includes all simple attributes (non composite, single-valued) from W – includes primary key attributes of the owners entity set E, as foreign key attributes – primary key of T is a combination of the partial key of W and primary key of E

STEP 3 RELATIONSHIP R (1:1) -> EXISTING RELATIONS T & S RELATIONS S and T: – relation S includes the primary key from T, as a foreign key – total participation is a tie-breaker in the decision on which one gets the foreign key (the one with the total participation) – relation S includes simple relationship attributes from R (if they exist)

Step 3 cont’d – alternative mapping of R is possible: merge the two participating entity sets and the relationship into a single relation appropriate when both participations are total – NOTE: A 1:1 relationship involving a weak entity has already been taken care of by the inclusion of the PK of the owner in the weak entity

STEP 4 RELATIONSHIP R (1:N) -> EXISTING RELATIONS T & S RELATIONS S and T: – relation T represents the entity set on 1 side of R and relation S represents the entity set on N side of R – relation S includes the primary key from T, as a foreign key – relation S includes simple relationship attributes from R (if they exist) – NOTE: A 1:N relationship involving a weak entity has already been taken care of by the inclusion of the PK of the owner in the weak entity

STEP 5 RELATIONSHIP R (M:N) -> NEW RELATION T: – includes primary keys of both entity sets involved in relationship R as foreign and they form the primary key of T – includes simple relationship attributes from R (if they exist) – this can be alternative approach for 1:1 relationships - primary key only from one of the participating entity sets would be included 1:N relationships - primary key from the entity set from the N side of the relationship would be included

STEP 6 MULTIVALUED ATTRIBUTE A -> NEW RELATION T (from the entity set E) RELATION T: – includes attribute A – includes primary key of E as a foreign key of T – attribute A and primary key of E form the primary key of T

STEP 7 N-ARY RELATIONSHIP R (N > 2) -> NEW RELATION T RELATION T: – includes primary keys of all entity sets involved in relationship R as foreign and they form the primary key of T – However, if entity involved as a 1 side, do not have to include as part of primary key – includes simple relationship attributes from R (if they exist)

7

7.2

Company DB using ERD Tool

Interesting examples to Map

Is that everything? Derived attributes? EER to relational mapping?

Step 8 - Mapping EER model concepts to Relations Superclass/Subclass and Specialization/Generalization – Convert each specialization with m subclasses {S1, S2,..Sm} – and superclass C where attributes of C are: {PK, A1,...An} – Using 1 of the following options:

Option A Create a new relation L with attributes of C Create new relations Li for each subclass Si with attributes {PK} U {attr. of Si}

Option B Create new relations Li for each subclass Si with attributes (attr. of Si} U {PK, Ai,..An}

Option C Create one new relation L with attributes {PK, Ai,..An}U {attr. of S1} U{attr. of S2}... U{attr. of Sm} U {t} t indicates subclass to which each tuple belongs

Option D Create one new relation L with attributes {PK, Ai,..An} U (attr. of S1} U{attr. of S2}... U {attr. of Sm} U {t1,... tm} – each ti is a Boolean indicating whether tuple belongs to Si – Can have one type field t, instead of m type fields

Summary of Options Option A – Create one table for superclass, and one table for each subclass Include PK of superclass in subclass tables Option B – Create one table for each subclass include superclass attributes in each subclass table Option C – Create one table with attributes from superclass and all subclasses Include 1 column to indicate which subclass a member of Option D – Create one table with attributes from superclass and all subclasses Include m columns, one for each subclass to indicate membership in that subclass

Multiple Inheritance Any of the options A-D will work

Example Mapping Map EER Example using these optionsEER Example Under which constraints do options perform better? Can mix mapping options for different specializations Rules to map from UML to relational?

Union Types Subclass of the union of 2 or more subclasses – create a new table – PK is a surrogate key, since it can have different types of PKs – Include surrogate key as foreign key in all tables corresponding to the superclasses – If entity is not a member of subclass, foreign key is null – Can add a type attribute to indicate to which superclass entity is a member