Mapping from conceptual model (EER-M)

Slides:



Advertisements
Similar presentations
Relational Database Design : ER- Mapping
Advertisements

3/25/2017.
Relational Database Design Via ER Modelling
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.
Mapping an ERD to a Relational Database To map an ERD to a relational database, five rules are defined to govern how tables are constructed. 1)Rule for.
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.
ER-to-Relational Mapping Jan. 2012ACS-3902 Yangjun Chen1 ER-to-Relational Mapping Principles Specialization/Generalization -Superclass/Subclass Relationship.
Methodology Logical Database Design for the Relational Model
Chapter 4 ENTITY-RELATIONSHIP MODELLING.
1 Enhanced Entity Relationship Modelling EER Model Concepts Includes all basic ER modeling concepts Additional concepts: subclasses/superclasses specialization/generalization.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Mapping ERM to relational database
Specialization and generalization
Database Systems ER and EER to Relational Mapping Toqir Ahmad Rana Database Management Systems 1 Lecture 18.
ER- and EER-to-Relational Mapping
Chapter 3 Relational Model Chapter 4 in Textbook.
Relational Database Design by ER- and EER-to-Relational Mapping
Lecture4: Informal guidelines for good relational design Mapping ERD to Relation Ref. Chapter3 Lecture4 1.
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
Entities and Attributes
Web-Enabled Decision Support Systems
Concepts and Terminology Introduction to Database.
CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
Chapter 11 & 12 Entity-Relationship (E-R) Model Characteristics of E-R Model Components of E-R Model Example of E-R Model Enhanced E-R Model.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
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 9 Logical Database Design : Mapping ER Model To Tables.
Chapter 6 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Chapter 17 Logical Database Design for the Relational Model Pearson Education © 2009.
ER/EER to Relational Data Model 1 Database Design.
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.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences The Relational.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 9 Relational Database Design by ER- and EERR-to-Relational Mapping Slide 9- 1.
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.
Enhanced Entity-Relationship and UML Modeling. 2.
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Databases (CS507) CHAPTER 7.
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
Conceptual Design & ERD Modelling
The Enhanced Entity- Relationship (EER) Model
Enhanced Entity-Relationship (EER) Modeling
Chapter 4: Part B Logical Database Design and the Relational Model
Logical Database Design for the Relational Model
Chapter Design Methodology Pearson Education © 2009.
Relational Database Design by ER- and EERR-to-Relational Mapping
9/5/2018.
Lecture3: Data Modeling Using the Entity-Relationship Model.
11/15/2018.
Chapter 4+17 The Relational Model Pearson Education © 2014.
Chapter 8: Mapping a Conceptual Design into a Logical Design
Relational Database Design by ER- and EER-to-Relational Mapping
EER to Relational Mapping
Relational Database Design by ER- and EER-to- Relational Mapping
Relational Database Design by ER- and EERR-to-Relational Mapping
4/11/2019.
Mapping an ERD to a Relational Database
Relational Database Design by ER- and EER-to-Relational Mapping
7/19/2019.
Presentation transcript:

Mapping from conceptual model (EER-M) 24/04/2017 Mapping from conceptual model (EER-M) into a relational schema prepared by chaamwe prepared by chaamwe

Lifecycle of Database system development

Mapping an EER-Model into a relational schema This approach involves applying transformation rules (or steps) to the EER model in order to achieve a relational logical schema. NB: the steps below should not be taken as golden rules. prepared by chaamwe

Mapping an EER-Model into a relational schema Application requirements vary from one domain to another and from one user to another. Hence, the following steps should be only taken as guidelines

Step 1 For each regular entity type (ignore those with subclasses at this point) on your diagram create a table and nominate a primary key (PK) for that relation. prepared by chaamwe

Step 1 Cont:

Step 2: For each weak entity type, create a relation. The PK is a combination of the identifier of the parent entity and the identifier of the weak or dependent entity (i.e. a composite PK). prepared by chaamwe

Step 2 cont

Step 4: Each unary or binary type relationship with a one-to-one cardinality is mapped by placing a foreign key attribute in one of the relational as the linking attribute. If the relationship is mandatory OR optional from both sides, then it does not make a difference as to where to place the foreign key. prepared by chaamwe

Step 4 Cont: If it is mandatory (total participation) from one side and optional (partial participation) from the other side, then the PK of the optional side is inserted as a foreign key at the mandatory side. prepared by chaamwe

Step 4 cont:

Step 5: For Each unary or binary one-to-many relationship type. The PK from the 1-end is inserted as a FK at the N-end. prepared by chaamwe

Step 5 cont:

Step 6: Each N:M relationship of any degree is mapped to a new linking relation whose PK includes the keys of all participating relations (a composite PK). Include all relationship’s attributes in the new relation. prepared by chaamwe

Step 6 cont:

Step 7: Each multi-value attribute mapped to a new relation. The new relation should include an attribute pertaining to the main relation as a foreign key. prepared by chaamwe

Step 7 cont:

Step 3.0 If we have a single optional (always!) subtype then: Create a relation for the superclass and identify a PK for it; Create a relation for the single subtype. The Subtype’s PK is the same as the one for the Superclass entity. Add all other specific attributes to the subclass.

Example

Step 3/ Multi Subclasses If we have more than one subtype, there are four different possibilities, depends on Business Rules (Constraints). These are: Disjoint Optional Disjoint Mandatory Overlapping Optional Overlapping Mandatory

Step 3a: If the participation is disjoint optional, then create a relation for the superclass and identify a PK for it. You also need to create a relation for each subclass. prepared by chaamwe

Step 3a: cont The subclass PK is the same as the one for the superclass entity. Add all other specific attributes.

disjoint optional EMPLOYEE D SECRETARY ENGINEER TECHNICIAN prepared by chaamwe

Step 3a Results EMPLOYEE (SSN, FNAME, MINT, LNAME,...); SECRETARY (SSN, TYPINGSPEED); TECHNICIAN (SSN, TGRADE); ENGINEER (SSN, ENGTYPE); prepared by chaamwe

Step 3b: If the participation is disjoint mandatory, then create a relation for each of the subclasses (no relation for the superclass) with the same PK you have chosen earlier for the superclass. Add all the specific attributes to the appropriate subclass. prepared by chaamwe

disjoint mandatory EG EMPLOYEE D SALARIED- EMPLOYEEE HOURLY- EMPLOYEE prepared by chaamwe

Step 3b Results SALARIED_EMPLOYEE (SSN, SALARY, FNAME, MINT, LNAME,...); HOURLY_EMPLOYEE (SSN, PAYSCALE, FNAME, MINT, LNAME,...); prepared by chaamwe

Step 3c: If the participation is overlapping optional, then create a single relation to represent the superclass and all its subclasses. Identify the PK, as well as, a type or flag attribute to specify class membership. The type attribute is used to indicate the participation occurrences of the superclass in the subclasses. prepared by chaamwe

Overlapping Optional The mapping is not recommended if many specific attributes are defined at the subclass, or if the subclasses are involved in relationships among themselves or with other entities. In these cases, this option should be treated as a disjoint optional (step 3a). prepared by chaamwe

overlapping optional EG EMPLOYEE O SECRETARY ENGINEER TECHNICIAN prepared by chaamwe

Step 3c Result EMPLOYEE (SSN, FNAME, MINT, LNAME, … JOBTYPE , TYPINGSPEED, TGRADE, ENGTYPE). OR EMPLOYEE (SSN, FNAME, MINT, LNAME, …, EMP_JOB (SSN, TYPINGSPEED, TGRADE, ENGTYPE) prepared by chaamwe

Step 3d The overlapping mandatory case. In this case you need to create a single relation to represent the superclass and all it subclasses. Identify the PK as well as a type or flag attribute to specify class membership. prepared by chaamwe

Step 3d cont: If the flag is “on” for a specific subclass means that the superclass has a specialisation. At least one of the flags should be “on”. Other flags could be “on” or “off”.

overlapping mandatory The mapping is not recommended if many specific attributes are defined at the subclass, or if the subclasses are involved in relationships among themselves or with other entities. In these cases, this option should be treated as a disjoint optional (step 3a). prepared by chaamwe

overlapping mandatory PART EG1 O MANUFACTURED PART PURCHASED PART prepared by chaamwe

Step 3d Result PART (PartNo, Description, MFlag, DrawingNo, ManufactureDate, BatchNo, PFlag, SupplierName, ListPrice); prepared by chaamwe

Other rules There are few semantic concepts that exist in the EER model that need to be resolved in order to be mapped easily into a relational logical model. prepared by chaamwe

Remove Complex Relationship This step involves removing or decomposing any relationship of degree d, where d is greater than two into d one-to-many relationships linked via a weak entity type. prepared by chaamwe

A ternary relationship TENANT LEASES STAFF PROPERTY prepared by chaamwe

A Decomposed ternary relationship TENANT PROPERTY STAFF HOLDS ASSOCIATED WITH ORGANISES LEASE AGREEMENT LEASE AGREEMENT prepared by chaamwe

Remove Recursive Relationships This step is to decompose any recursive relationship by creating a weak entity type prepared by chaamwe

Recursive Relationships supervises Employee prepared by chaamwe

Recursive Relationships supervises Allocated Staff Employee Allocated Staff Supervised by prepared by chaamwe

prepared by chaamwe