Relational Database Design

Slides:



Advertisements
Similar presentations
3/25/2017.
Advertisements

Week 5 Relational Database Design by ER- -to-Relational Mapping.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) 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.
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.
Transforming ER & EER diagrams into Relations (Chapter 9)
Dr. Bernard Chen Ph.D. University of Central Arkansas
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to-Relational Mapping.
Chapter 3 Relational Model Chapter 4 in Textbook.
Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008
Lecture4: Informal guidelines for good relational design Mapping ERD to Relation Ref. Chapter3 Lecture4 1.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- to-Relational Mapping.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- Mapping.
1 E/R to relational mapping algorithm – overview Mapping algorithm step 1-7 Steen Jensen, autumn 2013.
Slide Chapter 7 Relational Database Design by ER- to-Relational Mapping.
Ch.1 Introduction Ch.5 E-R Model (3) example.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
1 CS 430 Database Theory Winter 2005 Lecture 15: How to Convert an ER Model to Relations.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 6 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Software School of Hunan University Database Systems Design Part III : Mapping ER Diagram to Relational Schema.
Relational Database Design by ER- and EER-to-Relational Mapping The main reference of this presentation is the textbook and PPT from : Elmasri & Navathe,
Lecture4: Informal guidelines for good relational design Mapping ERD to Relation Prepared by L. Nouf Almujally Ref. Chapter3 Lecture4 1.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 9 Relational Database Design by ER- and EERR-to-Relational Mapping Slide 9- 1.
Database Design Slide 1 Database Design Lecture 7 part 2 Mapping ERD to Tables.
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)
Transforming ER models to relational schemas
Lecture (8) 1. Relational Database Design by ER- and EERR- to-Relational Mapping 2.
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.
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.
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Data Modeling Using the Entity- Relationship (ER) Model
Relational Database Design by ER- and ERR-to-Relational Mapping
Relational Database Design by ER- and EER-to- Relational Mapping
Entity- Relationship (ER) Model
Relational Database Design by ER- and EER-to- Relational Mapping
Logical Database Design for the Relational Model
Database Design – Lecture 4
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
Chapter (9) ER and EER-to-Relational Mapping, and other Relational Languages Objectives How a relational database schema can be created from a conceptual.
9/5/2018.
Chapter (9) ER and EER-to-Relational Mapping, and other Relational Languages Objectives How a relational database schema can be created from a conceptual.
Mapping ER Diagrams to Tables
11/15/2018.
CSE2DBF – CSE4DBF E-R Model Examples 06/03/2017
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
Relational Database Design (Top Down)
Database Modeling using Entity Relationship Model (E-R Model)
Relational Database Design by ER- and EER-to-Relational Mapping
Relational Database Design Examples
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
Chapter (7) ER-to-Relational Mapping, and other Relational Languages
Relational Database Design Relational Database Design
7/19/2019.
Relational Database Design by ER-to-Relational Mapping
Presentation transcript:

Relational Database Design TOPIC 3 (part 1) Relational Database Design (Top Down) Dr. WENNY RAHAYU Readings : Chpts 3 & 7, Elmasri & Navathe

Relational Database Design Two Approaches in Relational Database Design -- From Data Modeling ( eg. ER Model to Relational Logical Model for implementation. TOP DOWN DESIGN -- Normalization of Relations BOTTOM UP DESIGN Today’s lecture looks at top-down design, bottom-up design will be described the next lecture Topic 3 : Relational Database Design

Relational Database Design Consider the following ER-Diagram manages empNo deptNo name deptName 1 (1, 1) 1 (0, 1) address Department Employee M (1, 1) degree 1 (0, m) M (1, m) works for 1 (1, m) has works on projNo M (1, 1) M (1, m) projName Dependent Project dependentName M (0, m) dateOfBirth partNo supplies partName M (1, m) M (1, m) Supplier Part quantity supNo supName date Topic 3 : Relational Database Design

Relational Database Design (1) Transformation of E-R Model into Relational Logical Model ( Top Down design ) -- E-R to Relational Mapping Algorithm will be explained here step by step. STEP 1: For each entity in the ER model, create a relation ( i.e a table that includes all the simple attributes). Make sure to identify the primary key for the relation (i.e the PK of the entity). Note: if there is a specialization/generalization relationship in your EER (to be discussed in Topic 3- part 2, you need to transform the ‘superclass’ entity only within this Step 1). Taking the ER-Diagram on the previous slide as an example: EMPLOYEE (empNo, name, address) DEPARTMENT(deptNo, deptName) PROJECT(projNo, projTitle) SUPPLIER(supNo, supName) PART(partNo, partName) Topic 3 : Relational Database Design

Relational Database Design Transformation of E-R Model into Relational Logical Model ( Top Down design ) STEP 2: For each weak entity in the ER model, create a relation which includes all the simple attributes. The primary key of the relation is the combination of the primary key/s of the ‘owner’ and the the key of the weak entity itself. Employee empNo name address Dependent has dependentName dateOfBirth degree 1 (0, m) M (1, 1) DEPENDENT( empNo, dependentName, dateOfBirth) Topic 3 : Relational Database Design

Relational Database Design Transformation of E-R Model into Relational Logical Model ( Top Down design ) STEP 3: For each binary 1 TO 1 Relationship identify the two relations that correspond to the entities participating in the relationship. Choose one of the Relation ( usually the one with total participation) and include as foreign key the primary key of the the other relation. Employee Department manages empNo name address deptNo deptName degree 1 (0, 1) 1 (1, 1) DEPARTMENT( deptNo, deptName, mngrEmpNo) Topic 3 : Relational Database Design

Relational Database Design Transformation of E-R Model into Relational Logical Model ( Top Down design ) STEP4: For each binary 1 TO N Relationship identify the relations that represent the participating entity at the N (i.e many) side of the relationship. Include as foreign key in the relation that holds the N side, the primary key of the other entity (that holds the 1 side) Employee Department works for empNo name address deptNo deptName degree 1 (1, m) M (1, 1) EMPLOYEE (empNo, name, address, deptNo) Topic 3 : Relational Database Design

Relational Database Design Transformation of E-R Model into Relational Logical Model ( Top Down design ) STEP 5: For each binary M:N Relationship create a new relation to represent the relationship. The primary key of the new relation is the combination of the primary keys of the two connected entities. Employee Project works on empNo name address degree projNo projName M (1, m) WORKS ON (empNo, projNo) Topic 3 : Relational Database Design

Relational Database Design Transformation of E-R Model into Relational Logical Model ( Top Down design ) STEP 6: For each multivalued attribute, create a new relation that includes the multivalued attribute and the primary key of the entity where the multivalued attribute is attached. Employee empNo name address degree EMPLOYEE (empNo, name, address) EDEGREE(empNo, degree) Topic 3 : Relational Database Design

Relational Database Design Transformation of E-R Model into Relational Logical Model ( Top Down design ) STEP 7: For each n-ary ( > 2 ) Relationship create a new relation to represent the relationship. The primary key of the new relation is the combination of the primary keys of the participating entities that hold the N (many) side. In most cases of an n-ary relationship all the participating entities hold a many side. Project Supplier Part supplies supNo supName quantity date partNo partName projNo projName M (1, m) M (0, m) SUPPLIES (supNo , projNo, partNo , date, quantity) Topic 3: Relational Database Design

Final Tables PROJECT(projNo, projTitle) SUPPLIER(supNo, supName) Relational Database Design Final Tables PROJECT(projNo, projTitle) SUPPLIER(supNo, supName) PART(partNo, partName) DEPENDENT( empNo, dependentName, dateOfBirth) DEPARTMENT( deptNo, deptName, mngrEmpNo) EMPLOYEE (empNo, name, address, deptNo) WORKS ON (empNo, projNo) EDEGREE(empNo, degree) SUPPLIES (supNo , projNo, partNo , date, quantity) Topic 3 : Relational Database Design

Relational Database Design Owner# OwnerName OwnerAddress OWNER Maintenance# Date Type Cost Perform the complete transformation steps for the E-R Model described in Topic4. 1 (1, N) own Building# Address N (1, 1) (1, 1) incur Value (0, N) MAINTENANCE PROPERTY 1 N LeasePeriod (0, N) 1 N (0,N) Bond for rent (1, 1) Tenant# FamilyName FirstName ContactAddress Phone# ACCOUNT N (1, 1) ACReceipt# DateofPayment TypeOfAccount AmountPaid N M (1, N) pay TENANT (1, N) 1 1 Topic 3 : Relational Database Design

Relational Database Design Perform the complete transformation steps for the E-R Model of the ‘Real Estate Agency’ described in Topic4. SOLUTION: (to be discussed in the lecture) Topic 3 : Relational Database Design

EER Modeling and transformation Next Lecture … Topic 3 (part 2) – EER Modeling and transformation