Week 7-8 DBMS ER-Relational Mapping. ER-Relational Mapping.

Slides:



Advertisements
Similar presentations
Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Advertisements

Week 5 Relational Database Design by ER- -to-Relational Mapping.
Relational Database Design Via ER Modelling
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
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.
Chapter 6 Methodology Logical Database Design for the Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Database Design & Mapping
System Analysis - Data Modeling
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to- Relational Mapping.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Reduction of an E-R Schema to Tables A database which conforms to an E-R diagram can be represented.
Modeling & Designing the Database
Database Architecture The Relational Database Model.
Mapping ERM to relational database
Ch 6: ER to Relational Mapping
The Relational Database Model
Chapter 3 Relational Model Chapter 4 in Textbook.
Entity-Relationship modeling Transparencies
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.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Conversion from ER diagram to relational model
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- Mapping.
SQL Structured Query Language Programming Course.
1 E/R to relational mapping algorithm – overview Mapping algorithm step 1-7 Steen Jensen, autumn 2013.
1 CS 3630 Database Design and Implementation. 2 Sets Foundation of relational database. Basic Operations Power set Mapping.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
CS 370 Database Systems Lecture 9 The Relational model.
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:
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
Slide Chapter 7 Relational Database Design by ER- to-Relational Mapping.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
In this session, you will learn to: Map an ER diagram to a table Objectives.
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.
Databases Illuminated Chapter 3 The Entity Relationship Model.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
Software School of Hunan University Database Systems Design Part III : Mapping ER Diagram to Relational Schema.
Database Design – Lecture 6 Moving to a Logical Model.
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,
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
ER- Relational Mapping (Based on Chapter 9 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
Methodology - Logical Database Design. 2 Step 2 Build and Validate Local Logical Data Model To build a local logical data model from a local conceptual.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Data Modeling Using the Entity- Relationship (ER) Model
Entity- Relationship (ER) Model
Relational Database Design by ER- and EER-to- Relational Mapping
Entity-Relationship Model
Tables and Their Characteristics
Database Design – Lecture 4
Relational Database Design by ER- and EER-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.
Session 2 Welcome: The seventh learning sequence
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Review of Week 1 Database DBMS File systems vs. database systems
DBMS ER-Relational Mapping
Chapter (7) ER-to-Relational Mapping, and other Relational Languages
Presentation transcript:

Week 7-8 DBMS ER-Relational Mapping

ER-Relational Mapping

ER to Relational Mapping… In the Database Design process, we firstly derive a conceptual model (ER Diagram) This model needs to be mapped to the relational model in order to be implemented using a relational DBMS (RDBMS) This section discusses the rules that can be used for this process…

Model Mapping Moving from Conceptual (ER) to lower level Logical Model (Relational) ER is independent of the details of the implementation (relational, network or OO)_ Logical model begins to introduce issues specific to implementations (as realtional tables) Any such conversion is called a “ schema mapping ”

Core Concepts (Review) EntityAny object about which data is stored Relation2-d table to implement storage of data abut entities AttributeA property of an entity; stored as a column in a table Entity Instance A row (tuple) in a table (relation) A KeyThe use of an attribute to identify specific instances within a table

Core Concepts (Review) Candidate Key Any attribute that uniquely identifies each row in a table Primary KeyAn attribute selected from the candidate keys to be used to uniquely identify each row Composite Key A primary key tat is made up of two or more attributes Foreign KeyAn attribute that is not itself a key but is a PK in another table; to join tables in relational databases

ER to Relational Mapping… (contd.) ER ModelRelational Model – Entity(strong)  Relation – For example, ARTIST

ER ModelRelational Model – Simple Attributes  Attributes – For example, name ARTIST ER to Relational Mapping… (contd.) name ARTIST

ER ModelRelational Model – Primary Key  Primary Key – For example, ARTIST ER to Relational Mapping… (contd.) name ARTIST name

ER ModelRelational Model – Composite attributes  Set of simple atomic attributes – For example, EMPLOYEE fullname surname firstname ER to Relational Mapping… (contd.) firstname EMPLOYEE surname

Rules to Convert (ER – Tables) For 1:1 Cardinality, all attributes should be merged into single table 1:N ; post identifier (PK) from one side as an attribute into the many side N:M ; create a new table and post identifiers from each of the linked entities as attributes in the table

Conversion

FK

Conversion FK

ER ModelRelational Model – Multivalued attribute  Relation & Foreign Key – For example, ER to Relational Mapping… (contd.) ART-OBJECT materials id ART-OBJECT idmaterial MATERIALS

ER ModelRelational Model – N-ary relationship“Relationship” relation and n foreign keys – For example, pk C pk A pk B pk D pk C pk B pk A A B R C D A C B D r ER to Relational Mapping… (contd.)

ER ModelRelational Model Weak EntityRelations and combination of partial and primary keys Policy EMPLOYEE name age id DEPENDENTS 1 N

ER to Relational Mapping… (contd.) id EMPLOYEE age name id DEPENDENTS

Mapping - Summary ER ModelRelational Model Entity (strong) ->Relation Simple Attributes -> Attributes Primary Key -> Primary Key Composite attributes -> Set of simple attributes 1:1 or 1:N relationship -> Foreign keys M:N relationship -> Relation and foreign keys Multivalued attribute -> Relation and foreign key N-ary relationship -> Relation and n foreign keys Weak Entity -> Relation and combination of -> primary and partial keys

Your Turn

Use the rules introduced to build a set of tables Have two 1:N relations between Branch & Film Examine the link between Customer and Film copy