Chapter 9 Outline. Relational Database Design by ER and EERto-Relational. Mapping Fundamentals of Database Systems

Similar documents
Database Management

Chapter 9: Relational DB Design byer/eer to Relational Mapping Relational Database Design Using ER-to- Relational Mapping Mapping EER Model

Relational DB Design by ER- and EER-to-Relational Mapping Design & Analysis of Database Systems

Outline. Note 1. CSIE30600 Database Systems ER/EER to Relational Mapping 2

Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping

ER to Relational Mapping

Ch 9: Mapping EER to Relational. Follow a seven-step algorithm to convert the basic ER model constructs into relations steps 1-7

ER-to-Relational Mapping

Topic 5: Mapping of EER Diagrams to Relations

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

Chapter 8 The Enhanced Entity- Relationship (EER) Model

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 8 Data Modeling Advanced Concepts

This chapter discusses how to design a relational

MIT Database Management Systems Lesson 03: ER-to-Relational Mapping

SVY2001: Databases for GIS

THE ENHANCED ER (EER) MODEL CHAPTER 8 (6/E) CHAPTER 4 (5/E)

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

LELCTURE 4: ENHANCED ENTITY-RELATIONSHIP MODELING (EER)

Advanced Databases (SE487) Prince Sultan University College of Computer and Information Sciences

Translation ER/EER to relational

Relational Model: History

Chapter 8: Enhanced ER Model

DATABASE DESIGN I - 1DL300

DATA MODELING USING THE ENTITY-RELATIONSHIP MODEL. 1 Powered by POeT Solvers Limited

DATABASDESIGN FÖR INGENJÖRER F

Chapter 6. Advanced Data Modeling. Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise

Chapter 2: Entity-Relationship Model

DATABASE DESIGN I - 1DL300

SE 4DB3 TUTORIAL 2: REDUCTION TO RELATIONAL SCHEMAS

Let s briefly review important EER inheritance concepts

Chapter (4) Enhanced Entity-Relationship and Object Modeling

Objectives of logical design... Transforming the ERD diagram into relations. Relational database components. Mapping a composite attribute

Chapter 6: Entity-Relationship Model. E-R Diagrams

Chapter 17. Methodology Logical Database Design for the Relational Model

Objectives Definition iti of terms List five properties of relations State two properties of candidate keys Define first, second, and third normal for

Database Management System 6 ER Modeling...

DATABASTEKNIK - 1DL116

Chapter 6: Entity-Relationship Model

Sarajane Marques Peres, Ph.D. University of São Paulo Based on Elsmari, Navathe / Silberschatz, Korth, Sudarshan s books

Chapter 11 Object and Object- Relational Databases

CMP-3440 Database Systems

Chapter 7: Entity-Relationship Model

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

Chapter 7: Entity-Relationship Model

Conceptual Data Modeling

Database Design Process

Entity Relationship Data Model. Slides by: Shree Jaswal

The Basic (Flat) Relational Model. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 6: Entity-Relationship Model

Roadmap of This Lecture. Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML*

A l Ain University Of Science and Technology

OBJECTIVES. How to derive a set of relations from a conceptual data model. How to validate these relations using the technique of normalization.

Intro to DB CHAPTER 6

OVERVIEW OF DATABASE DEVELOPMENT

Chapter 7: Entity-Relationship Model

High Level Database Models

1/24/2012. Chapter 7 Outline. Chapter 7 Outline (cont d.) CS 440: Database Management Systems

COSC344 Database Theory and Applications. σ a= c (P) S. Lecture 4 Relational algebra. π A, P X Q. COSC344 Lecture 4 1

Chapter 6: Entity-Relationship Model

Conceptual Database Design (ER modeling) Chapter Three

CS 338 The Enhanced Entity-Relationship (EER) Model

Enhanced Entity- Relationship Models (EER)

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

Chapter 4. Enhanced Entity- Relationship Modeling. Enhanced-ER (EER) Model Concepts. Subclasses and Superclasses (1)

High-Level Database Models (ii)

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

The Entity-Relationship Model

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

Contents. Database. Information Policy. C03. Entity Relationship Model WKU-IP-C03 Database / Entity Relationship Model

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

Database Technology. Topic 4: Enhanced Entity- Relationship (EER) Modeling

Translating an ER Diagram to a Relational Schema

From ER to Relational Model. Book Chapter 3 (part 2 )

CONCEPTUAL DESIGN: ER TO RELATIONAL TO SQL

A l Ain University Of Science and Technology

Relational Model and Relational Algebra. Slides by: Ms. Shree Jaswal

Essentials of Database Management

Chapter 3 Database Modeling and Design II. Database Modeling

Chapter 7: Entity-Relationship Model. Chapter 7: Entity-Relationship Model

ERRDS: A CASE TOOL TO GENERATE AN ER DATA MODEL FROM A RELATIONAL DATABASE SCHEMA

Review -Chapter 4. Review -Chapter 5

Relational Model (cont d) & Entity Relational Model. Lecture 2

Advance Database Management System


Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4-1

The Entity-Relationship Model. The Entity-Relationship model. The ER model. The Entity-Relationship model. E-R Model Constructs. E-R Model Constructs

Unit 2. Unit 3. Unit 4

Overview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Handout 4. Logical Database Modeling, Part 1: Relational Data Model. Transforming EER model to Relational.

Database Design Process. Requirements Collection & Analysis

Entity-Relationship Model

Database Applications (15-415)

Object Modeling. Entity-Relationship (ER) diagrams (1976) Object Modelling Technique (OMT) diagrams (1991)

Enhanced Entity-Relationship (EER) Modeling

Lecture 10 - Chapter 7 Entity Relationship Model

THE RELATIONAL DATABASE MODEL

Relational Database Systems Part 01. Karine Reis Ferreira

DATABASE DESIGN I - 1DL300

Transcription:

204222 - Fundamentals of Database Systems Chapter 9 Relational Database Design by ER and EERto-Relational Mapping Chapter 9 Outline Relational Database Design Using ER-to- Relational Mapping Relational Database Design Using EER-to- Relational Mapping Adapted for 204222 by Areerat Trongratsameethong Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2 Relational Database Design by ER-and EER-to-Relational Mapping Relational Database Design Using ERto-Relational Mapping Design a relational database schema Based on a conceptual schema design Seven-step algorithm to convert the basic ER model constructs into relations 3 4

ER-to-Relational Mapping Algorithm COMPANY database example Assume that the mapping will create tables with simple single-valued attributes Step 1: Mapping of Regular Entity Types For each regular entity type, create a relation R that includes all the simple attributes of E Called entity relations Each tuple represents an entity instance 5 6 ER-to-Relational Mapping Algorithm (cont d.) Step 2: Mapping of Weak Entity Types For each weak entity type, create a relation Rand include all simple attributes of the entity type as attributes of R Include primary key attribute of owner as foreign key attributes of R 7 8

Step 3: Mapping of Binary 1:1 Relationship Types For each binary 1:1 relationship type Identify relations that correspond to entity types participating in R Possible approaches: Foreign key approach: e.g. Employee manages department (total participation : every department has a manager, PK Employee FK in Department, otherwise a lot of NULL in Employee) Merged relationship approach: when both entities are total participation Cross reference or relationship relation approach: create third relation and keeps PK of both entities, disadvantage: have one more table and join is needed to join data from both 9 Step 4: Mapping of Binary 1:N Relationship Types For each regular binary 1:Nrelationship type Identify relation that represents participating entity type at N-side of relationship type Include primary key of other entity type as foreign key in S Include simple attributes of 1:Nrelationship type as attributes of S Alternative approach Use the relationship relation (cross-reference) option as in the third option for binary 1:1 relationships 10 Step 5: Mapping of Binary M:NRelationship Types For each binary M:N relationship type Create a new relation S Include primary key of participating entity types as foreign key attributes in S Include any simple attributes of M:N relationship type Step 6: Mapping of Multivalued Attributes For each multivalued attribute Create a new relation Primary key of Ris the combination of Aand K If the multivaluedattribute is composite, include its simple components 11 12

Discussion and Summary of Mapping for ER Model Constructs Step 7: Mapping of N-ary Relationship Types For each n-aryrelationship typer Create a new relation Sto represent R Include primary keys of participating entity types as foreign keys Include any simple attributes as attributes 13 14 Discussion and Summary of Mapping for ER Model Constructs (cont d.) In a relational schema relationship, types are not represented explicitly Represented by having two attributes A andb: one a primary key and the other a foreign key 15 16

Mapping EER Model Constructs to Relations Extending ER-to-relational mapping algorithm Step 8: Options for Mapping Specialization or Generalization, Convert each specialization with m subclasses {S1, S2,..., Sm} and (generalized) superclass C, where the attributes of C are {k, a1,...an} and k is the (primary) key, into relation schemas using one of the following 4 options: 8A 8D 17 Mapping of Specialization or Generalization Option 8A: Multiple relations superclass and subclasses. Create a relation L for C with attributes Attrs(L) = {k, a1,..., an} and PK(L) = k. Create a relation Li for each subclass Si,1 i m, with the attributes Attrs(Li) = {k} {attributes of Si} and PK(Li) = k. This option works for any specialization (total or partial, disjoint or overlapping). Option 8B: Multiple relations subclass relations only. Create a relation Li for each subclass Si, 1 i m, withthe attributesattrs(li)={attributes ofsi} {k, a1,..., an} and PK(Li) = k. This option only works for a specialization whose subclasses are total(every entity in the superclass must belong to (at least) one of the subclasses). Additionally, it is only recommended if the specialization has the disjointedness constraint. If the specialization is overlapping, the same entity may be duplicated in several relations. 18 Mapping of Specialization or Generalization Mapping of Shared Subclasses (Multiple Inheritance) Option 8C:Single relation with one type attribute Create a single relation L with attributes Attrs(L) = {k, a1,..., an} {attributes of S1}... {attributes of Sm} {t} and PK(L) = k. The attribute t is called a type(or discriminating) attribute whose value indicates the subclass to which each tuple belongs, if any. This option works only for a specialization whose subclasses are disjoint, and has the potential for generating many NULL values if many specific attributes exist in the subclasses. Apply any of the options discussed in step 8 to a shared subclass Option 8D:Single relation with multiple type attributes Create a single relation schema L with attributes Attrs(L) = {k, a1,..., an} {attributes of S1}... {attributes of Sm} {t1, t2,..., tm} and PK(L) = k. Each ti, 1 i m, is a Boolean type attribute indicating whether a tuple belongs to subclass Si. This option is used for a specialization whose subclasses are overlapping (but will also work for a disjoint specialization). Mflag, Pflag 19 20

Mapping of Categories (Union Types) Step 9: Mapping of Union Types (Categories) Defining superclasses have different keys Specify a new key attribute Surrogate key Surrogate key 21 22 Summary Map conceptual schema design in the ER model to a relational database schema Algorithm for ER-to-relational mapping Illustrated by examples from the COMPANY database Include additional steps in the algorithm for mapping constructs from EER model into relational model 23