EER to Relational Mapping

Slides:



Advertisements
Similar presentations
Relational Database Design : ER- Mapping
Advertisements

3/25/2017.
Mapping ER to Relational Model
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.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Enhanced Entity-Relationship (EER) Modeling.
ER-to-Relational Mapping Jan. 2012ACS-3902 Yangjun Chen1 ER-to-Relational Mapping Principles Specialization/Generalization -Superclass/Subclass Relationship.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping.
1 Enhanced Entity Relationship Modelling EER Model Concepts Includes all basic ER modeling concepts Additional concepts: subclasses/superclasses specialization/generalization.
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.
Summary of Mapping constructs and constraints
Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Chapter 4 The Enhanced Entity-Relationship (EER) Model
Database Systems ER and EER to Relational Mapping Toqir Ahmad Rana Database Management Systems 1 Lecture 18.
Dr. Bernard Chen Ph.D. University of Central Arkansas
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
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Normalization.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design by ER to Relational Mapping by Pinar Senkul resources: mostly.
Mapping from conceptual model (EER-M)
Relational Database Design by ER- and EERR-to-Relational Mapping.
Enhanced Entity-Relationship (EER) Modeling. Slide 4- 2 Chapter Outline EER stands for Enhanced ER or Extended ER EER Model Concepts Includes all modeling.
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.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4- 1.
ER-TO-RELATIONAL MODEL MAPPING CONTENT SOURCES: ELAMSARI AND NAVATHE, FUNDAMENTALS OF DATABASE MANAGEMENT SYSTEMS.
Topic 4 - Part I Enhanced Entity-Relationship and UML Modeling
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.
Introduction to Database Systems
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.
Databases (CS507) CHAPTER 8
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Lecture # 21 Chapter # 7 Relational Database Design by ER- and EER-to-Relational Mapping Muhammad Emran Database Systems.
Relational Database Design by ER- and ERR-to-Relational Mapping
Relational Database Design by ER- and EER-to- Relational Mapping
Enhanced Entity-Relationship (EER) Model
Relational Database Design by ER- and EER-to- Relational Mapping
The Enhanced Entity- Relationship (EER) Model
Enhanced Entity-Relationship (EER) Modeling
EER Model – Chapter
Session 2 Welcome: The sixth learning sequence
Enhanced Entity-Relationship (EER) Modeling
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
Relational Database Design by ER- and EER-to- Relational Mapping
Sampath Jayarathna Cal Poly Pomona
Relational Database Design by ER- and EERR-to-Relational Mapping
4/11/2019.
Sampath Jayarathna Cal Poly Pomona
Enhanced Entity-Relationship (EER) Modeling
Relational Database Design by ER- and EER-to-Relational Mapping
Enhanced Entity-Relationship (EER) Modeling
CS4222 Principles of Database System
7/19/2019.
Presentation transcript:

EER to Relational Mapping January 17, 2019 DB:EER Model - 1

Objectives Introduction + Non-shared class Mapping + Categories Mapping + Summary + January 17, 2019 DB:EER Model - 1

- Introduction In previous lecture we have looked at the mapping of ER diagram to relational schemas. In this lecture we will look at the mapping of the additional construct of EER diagrams to relational schemas. We start by discussing the mapping of the superclass/subclass relationship. After that we will look at the shared subclasses mapping. Finally we will look at the categories mapping. January 17, 2019 DB:EER Model - 1

- Non-Shared Classes Mapping Now we will look at the mapping of specialization with m subclasses {S1, S2, … , Sm} and (generalized) superclass C, where the attributes of C are {k, a1, a2, …, an} and k is the primary key, into relational schemas. There are four options (A, B, C, or D) as will be described later. Options A and B: also called the multiple relations options, produce multiple relations to map the superclass/subclass relationship. Options C and D: also called the single relation options, produce only a single relation to map the superclass/subclass relationship. January 17, 2019 DB:EER Model - 1

-- Option A Create a relation L for C with attributes Attrs(L) = {k, a1, a2, …, an} and PK(L) = k. Create a relation Li for each subclass Si, 1 <= I <= m, with the attributes Attrs(Li) = {k} U {attributes of Si} and PK(Li) = k. Each Li includes the specific (or local) attributes of Si, plus the primary key of the superclass C, which is propagated to Li and becomes its primary key. An EQUIJOIN operation on the primary key between any Li and L produces all the specific and inherited attributes of the entities in Si. The following figure shows how option A is used to map the EMPLOYEE superclass/subclass relationship. January 17, 2019 DB:EER Model - 1

EER REL. EMPLOYEE SECRETARY TECHNICIAN ENGINEER SSN Fname Minit Lname Bdate Address Jobtype SECRETARY TECHNICIAN ENGINEER SSN TypingSpeed SSN TGrade SSN EngType January 17, 2019 DB:EER Model - 1

-- Option B Create a relation Li for each subclass Si; 1 <= I <= m, with Attrs(Li) = attributes of Si} U {k, a1, a2, …, an} and PK(L) = k. January 17, 2019 DB:EER Model - 1

--- Example: Option B VEHICLE CAR TRUCK EER REL. CAR TRUCK VehicleId PlateNo Price d NoOfAxles Tonnage NoOfPassangers MaxSpeed CAR TRUCK EER REL. CAR VehicleId PlateNo Price NoOfPassangers MaxSpeed TRUCK VehicleId PlateNo Price NoOfAxles Tonnage January 17, 2019 DB:EER Model - 1

-- Option C (Disjoint Subclasses) Create a single relation L with attributes Attrs(L) = {k, a1, a2, …, an} U {attributes of S1} U . . . {attributes of Sm} U {t} and PK(L) = k. This option is for specialization whose subclasses are disjoint, and t is a type (or discriminating) attribute that indicates the subclass to which each tuple belongs, if any. This option has the potential for generating a large number of null values January 17, 2019 DB:EER Model - 1

EER REL. EMPLOYEE SSN Fname Minit Lname Bdate Address Jobtype TGrade EngType TypingSpeed January 17, 2019 DB:EER Model - 1

-- Option D (Overlapping Subclasses) Create a single relation schema L with attributes Attrs(L) = {k, a1, a2, …, an} U {attributes of S1} U . . . U {attributes of Sm} U {t1, t2, . . ., tm} and PK(L) = k. This option is for specialization whose subclasses are overlapping (but will also work for a disjoint specialization), and each ti, 1 <= I <= m, is a boolean attribute indicating whether a tuple belongs to subclass Si. January 17, 2019 DB:EER Model - 1

--- Example: Option D EER REL. PART PartNo Description MFlag DrawingNo ManufactureDate BatchNo PFlag SupplierName ListPrice January 17, 2019 DB:EER Model - 1

- Shared Class Mapping As it was stated during the discussion of EER concepts, a shared subclass is a subclass of several superclasses, such as ENGINEERING_MANAGER. These classes must all have the same key attribute; otherwise, the shared subclass would be modeled as a category, which will be discussed later. We can apply any of the options discussed in the previous step to a shared subclass, although usually option A is used. January 17, 2019 DB:EER Model - 1

- Category Mapping … A category is a subclass of the union of two or more superclasses that can have different keys because they can be of different entity types. An example is the OWNER category shown in the following figure, which is a subset of the union of three entity types PERSON, BANK, and COMPANY. The other category in that figure, REGISTERED_VEHICLE, has two superclasses that have the same key attribute. For mapping a category whose defining superclass have different keys, it is customary to specify a new key attribute, called a surrogate key, when a relation to correspond to the category. This is because the keys of the defining classes are different, so we cannot use any one of them exclusively to identify all entities in the category. January 17, 2019 DB:EER Model - 1

… - Category Mapping We can now create a relation schema OWNER to correspond to the OWNER category, as illustrated in, and include any attributes of the category in this relation. The primary key of OWNER is the surrogate key OwnerId. We also add the surrogate key attribute OwnerId as a foreign key to each relation corresponding to a superclass of the category, to specify the correspondence in valued between the surrogate key and the key of each superclass. For a category whose superclasses have the same key, such as VEHICLE in the figure, there is no need for a surrogate key. The mapping of the REGISTERED_VEHICLE category, which illustrates this case, is also shown in the mapping figure. January 17, 2019 DB:EER Model - 1

--- Example: Category Mapping SSN PERSON Name BANK Address COMPANY Name Name Address License Address U U OWNER EER REL. PERSON SSN License Name Address OwnerId BANK BName BAddress OwnerId COMPANY CName CAddress OwnerId OWNER OwnerId January 17, 2019 DB:EER Model - 1

January 17, 2019 DB:EER Model - 1

January 17, 2019 DB:EER Model - 1

January 17, 2019 DB:EER Model - 1