Sept. 20041 ER-to-Relational Mapping Principles ER-to-Relational Mapping And examples.

Slides:



Advertisements
Similar presentations
ER Model For a college DB
Advertisements

Relational Database Design : ER- Mapping
Week 5 Relational Database Design by ER- -to-Relational Mapping.
Relational Database Design Via ER Modelling
Mapping ER to Relational Model
Database technology Lecture 4: Mapping of EER model to relations Jose M. Peña
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.
Data modeling using the entity-relationship model Sept. 2012Yangjun Chen ACS Outline: Data modeling using ER-model (Chapter 3 - 3rd, 4th, 5th ed.)
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.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping.
Translating ER Model into Relational Model. ER Model  Relational Model Considerations: Minimize the number of relations to reduce query- processing time.
ER- Relational Mapping (Based on Chapter 7 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 4)
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.
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
Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008
Relational Database Design by ER- and EER-to-Relational Mapping
1 DATABASE By Mr. Abdalla A. Shaame.  What is a database?  The main characters of a database system  The basic database design method  The entity-relationship.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
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.
The Relational Model1 ER-to-Relational Mapping and Views.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design by ER to Relational Mapping by Pinar Senkul resources: mostly.
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
COMP231 Tutorial 1 ER Model and ER to Relational Schema.
Slide Chapter 7 Relational Database Design by ER- to-Relational Mapping.
1 CS 430 Database Theory Winter 2005 Lecture 15: How to Convert an ER Model to Relations.
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.
Software School of Hunan University Database Systems Design Part III : Mapping ER Diagram to Relational Schema.
CS 405G: Introduction to Database Systems Lecture 5: Logical Design by Relational Model Instructor: Chen Qian.
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,
Instructor: Jinze Liu Fall Phases of Database Design u Conceptual design begins with the collection of requirements and results needed from the.
advanced data modeling
ER-TO-RELATIONAL MODEL MAPPING CONTENT SOURCES: ELAMSARI AND NAVATHE, FUNDAMENTALS OF DATABASE MANAGEMENT SYSTEMS.
CS 405G: Introduction to Database Systems Relations.
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
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping.
Translation of EER model into relational model Jose M. Peña
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.
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.
Chapter (9) ER and EER-to-Relational Mapping, and other Relational Languages Objectives How a relational database schema can be created from a conceptual.
Example A university registrar’s office maintains data about the following entities: (a) courses, including number, title, credits, syllabus, and prerequisites;
Relational Database Design by ER- and EER-to-Relational Mapping
Relational Database Design by ER- and EER-to- Relational Mapping
Chapter (7) ER-to-Relational Mapping, and other Relational Languages
Relational Database Design by ER-to-Relational Mapping
Presentation transcript:

Sept ER-to-Relational Mapping Principles ER-to-Relational Mapping And examples

Sept General process 1. Create a relation for each strong entity type 2. Create a relation for each weak entity type 3. For each binary 1:1 relationship choose an entity and include the other’s PK in it as an FK 4. For each binary 1:n relationship, choose the n-side entity and include an FK with respect to the other entity. 5. For each binary M:N relationship, create a relation for the relationship 6. For each multi-valued attribute create a new relation 7. For each n-ary relationship, create a relation for the relationship

Sept Create a relation for each strong entity type include all simple attributes choose a primary key Suppose we have: course 1N offered in Section no term meeting course no name credit hours description section

Sept We create a relation for Course - four attributes, course_no is the PK. course 1N offered in Section no term meeting course no name credit hours description section Course Course_nonamecredit_hoursdescription

Sept Create a relation for each weak entity type include primary key of owner (an FK) Owner’s PK + partial key become the PK Suppose we have: course 1N offered in Section no term meeting course no name credit hours description section

Sept We create a relation for Section course 1N offered in Section no term meeting course no name credit hours description section Section Course_noSection_noTerm PK is {course_no, section_no}. course_no is an FK. meeting is not a simple attribute, so it’s not included.

Sept How to handle the identifying relationship in which a weak entity set is involved? Relation for a weak entity set must include multiple attributes for its complete key (including those belonging to its identifying entity sets), as well as its own, partial key attributes. An identifying (double-diamond) relationship is redundant and yields no relation.

Sept An example showing LoginsHostsAt name Hosts(hostName) this is for the strong entity set. Logins(loginName, hostName, time) At(loginName, hostName, hostName2) Must be the same time At becomes part of Logins, so eliminated!

Sept For each binary 1:1 relationship choose an entity and include the other’s PK in it as an FK. departmentinstructor chair 11 dept_no dname instr_noiname There are two choices here choose department, or choose instructor Which is the better choice?

Sept Department is the better choice since it must participate in the relationship. departmentinstructor chair 11 dept_no dname instr_noiname Department chairdept_nodname If we choose department then instr_no is included as, of course, an FK. Note that instr_no must have a value.

Sept For each binary 1:n relationship, choose the n-side entity and include an FK w.r.t the other entity. departmentinstructor employs 1N dept_no dname instr_noiname We must choose instructor We end up with: instructor instr_noinamedept_no PK is instr_no dept_no is an FK Note that Step 1 would lead to the instructor relation - we have now augmented instructor with the dept_no attribute.

Sept For each binary M:N relationship, create a relation for the relationship include PKs of both participating entities and any attributes of the relationship PK is the catenation of the participating entities’ PKs studentcourse enroll mn grade Enroll student_noCourse_nograde PK is {student_no, course_no} student_no is a FK course_no is a FK grade is an attribute of Enroll course_no student_no

Sept For each multi-valued attribute create a new relation include the PK attributes of the entity type PK is the PK of the entity type and the multi-valued attribute course 1N offered in Section no term meeting course no name credit hours description section Meeting is a multi-valued attribute

Sept Create a relation for meeting Section was created because of Step 2 - its PK is {course_no, section_no} meeting Meeting course_nosection_nomeeting PK is {course_no, section_no, meeting}. Meeting is an all-key relation.

Sept For each n-ary relationship, create a relation for the relationship include PKs of all participating entities and any attributes of the relationship PK may be the catenation of the participating entity PKs (depends on cardinalities) semestercourse offers mn room course_no semester_no instructor instr_no p

Sept We need one relation, offers, with PK of {semester_no, course_no, instr_no} semestercourse offers mn room no course_no semester_no instructor instr_no p Offers course_noinstr_nosemester_noRoom_no

Sept Another perspective to see how to map E/R Diagrams to Relations Entity sets become relations with the same set of attributes. –Regular entity set –Weak entity set – need help Relationships –Identifying relationship eliminated, actually merged to weak entity set relation. –Regular relationship become relations whose attributes are only: –The keys of the connected entity sets. –Attributes of the relationship itself.

Sept Combining Relations for binary relationship Then to combine the relation for an entity- set E with the relation R for a many-one relationship from E to another entity set. Of course, the combination (merging) is applicable to one-one relationship. –To avoid null values, we chose full participating entity set relation to add a foreign key referencing the opposite entity set.