Switch off your Mobiles Phones or Change Profile to Silent Mode.

Slides:



Advertisements
Similar presentations
ER Modeling Case Studies
Advertisements

Relational Database Design : ER- Mapping
Exercise 1 Consider the ER diagram below. Assume that an employee may work in up to two departments or may not be assigned to any department. Assume that.
Database Design Using Entity-Relationship Models zMapping E-R models into relations zFour common data structures.
1 Design Process - Where are we? Conceptual Design Conceptual Schema (ER Model) Logical Design Logical Schema (Relational Model) Step 1: ER-to-Relational.
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.
Enhanced Entity-Relationship and Object Modeling (Ch 4) Jan R McFadyen1 Class/subclass relationships Inheritance Specialization Generalization.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 7- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
ER-to-Relational Mapping Jan. 2012ACS-3902 Yangjun Chen1 ER-to-Relational Mapping Principles Specialization/Generalization -Superclass/Subclass Relationship.
Transforming an ER Model into a Relational Schema  Cs263 Lecture 10.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping.
ENTITY RELATIONSHIP DATA MODEL ELIZABETH GEORGE. INTRODUCTION Architect Aeronautical engineers Computer architects Traffic engineers.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- 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.
Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
December 4, 2002 Data Modeling – James Cohen Enhanced Entity Relationship (EER) Model Presented by James Cohen.
Database Systems ER and EER to Relational Mapping Toqir Ahmad Rana Database Management Systems 1 Lecture 18.
Ch 6: ER to Relational Mapping
Chapter 3 Relational Model Chapter 4 in Textbook.
Lecture4: Informal guidelines for good relational design Mapping ERD to Relation Ref. Chapter3 Lecture4 1.
Entities and Attributes
CSE 441: Systems Analysis & Design
BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)
Switch off your Mobiles Phones or Change Profile to Silent Mode.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 4 Mapping an ER model to tables © Akhilesh Bajaj,
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design by ER to Relational Mapping by Pinar Senkul resources: mostly.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
Mapping from conceptual model (EER-M)
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
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.
Data Modelling Using Entity-Relationship (ER) Model
Software School of Hunan University Database Systems Design Part III : Mapping ER Diagram to Relational Schema.
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
ER/EER to Relational Data Model 1 Database Design.
Lecture4: Informal guidelines for good relational design Mapping ERD to Relation Prepared by L. Nouf Almujally Ref. Chapter3 Lecture4 1.
Introduction to Database Systems
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
Mapping ER Diagrams to Tables
COMP 430 Intro. to Database Systems ER Implementation as Tables Slides use ideas from Chris Ré.
Introduction to Database Systems
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping.
Enhanced Entity-Relationship and UML Modeling. 2.
Advanced Database and Client Server Applications Susan Curtis, Paul Crowther, Alan Houldcroft, Peter Lake, John Whitfield.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Databases (CS507) CHAPTER 7.
Data Modeling Using the ERD
Relational Database Design by ER- and ERR-to-Relational Mapping
Relational Database Design by ER- and EER-to- Relational Mapping
Enhanced Entity-Relationship and Object Modeling Objectives
Enhanced Entity-Relationship (EER) Modeling
Session 2 Welcome: The sixth learning sequence
Database EER.
9/5/2018.
Lecture3: Data Modeling Using the Entity-Relationship Model.
Mapping ER Diagrams to Tables
11/15/2018.
Outline: Database Basics
Chapter 4+17 The Relational Model Pearson Education © 2014.
Chapter 8: Mapping a Conceptual Design into a Logical Design
Subclasses and Superclasses
EER to Relational Mapping
CS4222 Principles of Database System
4/11/2019.
Relational Database Design by ER- and EER-to-Relational Mapping
7/19/2019.
Presentation transcript:

Switch off your Mobiles Phones or Change Profile to Silent Mode

Transforming an ER Model to a Relational Schema

Topics Introduction Transformation of Binary relationships Unary relationships Ternary Relationships Subclasses / Superclasses

Transforming ER Model into Relational Schema There are a set of guidelines to convert an ER model into a relational schema. They are not hard and fast rules and Database Designer must use them wisely. ER model consists of 3 major concepts which have to be transformed Entity types Attributes Relationships

Transformation of Entity Types Each entity type is usually represented by a relation (table) DOCTOR(…………..) DOCTOR

Transformation of Attributes Attributes of Entity become columns of relation (table). DOCTOR Doc-no Name Title Speciality Doc-noNameTitleSpeciality DOCTOR

Transformation of Relationships Different Relationship Types Unary, Binary, Ternary Degree of Relationship Types 1:1 1:M M:N Optionality of Relationship Types Mandatory Optional

Transformation of Binary Relationships One to Many and Mandatory DEPARTMENT (dno, dname, location) PROJECT (pno, dno*, title, sdate, edate) DEPARTMENT PROJECT runs

Transformation of Binary Relationships One to Many and Mandatory So why not post pno into DEPARTMENT? DEPARTMENT (dno, pno*, dname, location) PROJECT (pno, title, sdate, edate) DEPARTMENT PROJECT runs dnopnodnamelocation D1P5SalesLondon D1P6SalesLondon D2P7ClaimsCardiff

Transformation of Binary Relationships One to Many and Mandatory ORDER (orderno, date) ORDER-DETAIL (Product_No, orderno*, qty, subtotal) ORDER ORDER-DETAIL contains

Transformation of Binary Relationships One to Many and Optional BORROWER (borrower-no, name, address) BOOK (catalog-no, title, ISBN, publisher) LOANS (catalog-no*, borrower-no*, date- out, date-due) BORROWER BOOK loans

Transformation of Binary Relationships Many to Many and Mandatory EMPLOYEE (emp-no, name, address) PROJECT (p-no, ptype, duration) WORKS-ON (emp-no*, p-no*) EMPLOYEE PROJECT Works on

Transformation of Binary Relationships Many to Many and Mandatory So why not post emp-no or p-no into original entity? EMPLOYEE (emp-no, p-no*,name, address) PROJECT (p-no, emp-no*, ptype, duration) EMPLOYEE PROJECT Works on Emp-noP-nonameaddress E11P1SmithLondon E11P2SmithLondon P-noEmp-noptypeduration P1E11Custom12 P1E11Custom12

Transformation of Binary Relationships Many to Many and Optional SUPPLIER (supp-no, name, address) PRODUCT (pcode, pname, colour) SUPPLIES (supp-no*, pcode*, min-order) SUPPLIER PRODUCT supplies

Transformation of Binary Relationships One to One and Mandatory PERSON (person-no, pname, address, job) BIRTH-CERTIFICATE (person-no*, registered, date-reg) PERSON BIRTH- CERTIFICATE has

Transformation of Binary Relationships One to One and Optional EMPLOYEE (emp-no, name, job-type) VEHICLE (vno, emp-no*, make, model, colour) OR VEHICLE (vno, make, model, colour) EMPLOYEE (emp-no, vno*, name, job-type) EMPLOYEE VEHICAL assigned

Transformation of Unary Relationships One to One PERSON (person-id, pname, address) MARRY (person-id*, spouse-id*, date) PERSON marry

Transformation of Unary Relationships One to Many (for mostly mandatory) EMPLOYEE (emp-id, super-no*, ename, salary) EMPLOYEE supervises

Transformation of Unary Relationships One to Many (for mostly optional) EMPLOYEE (emp-id, ename, salary) SUPERVISES (emp-id*, super-no*) EMPLOYEE supervises

Transformation of Unary Relationships Many to Many PART (part-no, pname, description) COMPRISES (major-part-no*, minor-part- no*, qty) PART Comprises

Transformation of Ternary Relationships

Transformation of Superclasses/Subclasses Option A Create a new relation for each subclass and a relation for the superclass. Use the primary key of the superclass as the primary key for each relation.

Transformation of Superclasses/Subclasses EMPLOYEE (emp-no, emp-name, address, job-type) SECRETARY (emp-no*, typing-speed) TECHNICIAN (emp-no*, tgrade) ENGINEER (emp-no*, eng-type)

Transformation of Superclasses/Subclasses Problem with this option: In order to extract all super and sub class attributes we must JOIN the relations

Transformation of Superclasses/Subclasses Option B Create a new relation for each subclass and include in each one all the attributes of the superclass. Use the primary key of the superclass for each of the new relations.

Transformation of Superclasses/Subclasses CAR (Vehicle-no, License-no, Price, MaxSpeed, NoOfPassengers) TRUCK (Vehicle-no, License-no, Price, NoOfAxles, Tonnage)

Transformation of Superclasses/Subclasses Problems with this option: We have no good way of finding all VEHICLES which are not CARS or TRUCKS. We have to search through all relations to find a particular VEHICLE superclass. If an entity belongs to more than one subclass we have redundant information.

Any Questions?