Relational Database Design Via ER Modelling

Slides:



Advertisements
Similar presentations
EER to Relation Models Mapping
Advertisements

3/25/2017.
Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Week 5 Relational Database Design by ER- -to-Relational Mapping.
1 Design Process - Where are we? Conceptual Design Conceptual Schema (ER Model) Logical Design Logical Schema (Relational Model) Step 1: ER-to-Relational.
the Entity-Relationship (ER) Model
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.
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.
Ch 6: ER to Relational Mapping
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.
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
Relational Database Design by ER- and EER-to- Relational Mapping
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 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.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
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.
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,
Chapter 5 ER-to- Relational Mapping HUANG XUEHUA.
DatabaseIM ISU1 Chapter 7 ER- and EER-to-Relational Mapping Fundamentals of Database Systems.
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,
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)
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
Relational Database Design by ER- and EER-to-Relational Mapping
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
Relational Database Design by ER- and EER-to- Relational Mapping
Relational Database Design by ER- and EER-to-Relational Mapping
ER- and EER-to-Relational
Relational Database Design by ER- and EERR-to-Relational Mapping
Relational Database Design by ER-to-Relational Mapping
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
Relational Database Design by ER- and EER-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.
Relational Database Design by ER-to-Relational Mapping
Presentation transcript:

Relational Database Design Via ER Modelling Chapter 9 (6/E) Chapter 7 (5/E)

Lecture Outline Relational Database Design Using ER-to-Relational Mapping Algorithm to convert the basic ER model constructs into relations Mapping EER Model Constructs to Relations Additional steps for EER model

Recall (basic) ER Diagram

End Goal: Relational Model

Step 1: Map Regular Entity Types For each regular entity type, create a relation schema R that includes all the single-valued attributes of E “Flatten” composite attributes Example renames some attributes (e.g., Dname), but not needed Pick one of the keys as “primary key” and declare the rest to be unique Called entity relations Each tuple represents an entity instance

Step 2: Map Weak Entity Types For each weak entity type, create a relation schema R and include all single-valued attributes of the weak entity type and of the identifying relationship as attributes of R Include primary key attribute of identifying entity as foreign key attribute of R Primary key of R is primary key of identifying entity together with partial key from R Omit the identifying relationship when subsequently translating (other) relationship types to relation schemas

Step 3: Map Binary 1:1 Relationship Types For each binary 1:1 relationship type R, identify relation schemas that correspond to entity types participating in R Apply one of three possible approaches: Foreign key approach Add primary key of one participating relation as foreign key attribute of the other, which will also represent R If only one side is total, choose it to represent R (why?) Declare foreign key attribute as unique Merged relationship approach Combine the two relation schemas into one, which will also represent R Make one of the primary keys “unique” instead Cross-reference or relationship relation approach Create new relation schema for R with two foreign key attributes being copies of both primary keys Declare one of the attributes as primary key and the other one as unique Add single-valued attributes of relationship type as attributes of R

Step 4: Map Binary 1:N Relationship Types Foreign key approach Identify relation schema S that represents participating entity type at N-side of 1:N relationship type Include primary key of other entity type (1-side) as foreign key in S Relationship relation approach Create new relation schema for S with two foreign key attributes being copies of both primary keys Declare the foreign key attribute for the relation schema corresponding to the participating entity type on the N-side as primary key Include single-valued attributes of relationship type as attributes of S

Step 5: Map Binary M:N and Higher order Relationship Types For each binary M:N relationship type or ternary or higher order relationship type, create a new relation S Include primary key of participating entity types as foreign key attributes in S Make all these attributes primary key of S Include any simple attributes of relationship type in S

Step 6: Map Multivalued Attributes For each multivalued attribute Create new relation R with attribute to hold multivalued attribute values If multivalued attribute is composite, include its simple components Add attribute(s) for primary key of relation schema for entity or relationship type to be foreign key for R Primary key of R is the combination of all its attributes

Options for Mapping Specialization or Generalization For any specialization (total or partial, disjoint or overlapping) Separate relation per superclass and subclasses Single relation with at least one attribute per subclass Introduce a Boolean attribute if none specific for subclass

Specialization Options (cont’d) For total specializations (and generalizations) only Separate relation per subclass relations only Overlapping subclasses will result in multiple tuples per entity For disjoint specializations only Single relation with one type attribute Type or discriminating attribute indicates subclass of tuple Might require many NULL values if several specific attributes exist in subclasses

Mapping Union Types Create relation schema to represent union type (generalization) Specify a new key attribute Surrogate key Example: Owner and Registered Vehicle

Lecture Summary Algorithm for ER-to-relational mapping Extensions for mapping constructs from EER model into relational model

Exercise Translate the following ER Diagram into a relational database schema.

Exercise What ER Diagram might produce the following relational database schema?