DBMS 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.
Database Design & Mapping
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
©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.
Database Architecture The Relational Database Model.
Mapping ERM to relational database
The Relational Database Model
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
SQL Structured Query Language Programming Course.
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 
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)
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
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.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
Database Design – Lecture 6 Moving to a Logical Model.
Week 7-8 DBMS ER-Relational Mapping. ER-Relational Mapping.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
© 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.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Chapter 3: Modeling Data in the Organization
Data Modeling Using the Entity- Relationship (ER) Model
COP Introduction to Database Structures
Business System Development
Entity- Relationship (ER) Model
Methodology Logical Database Design for the Relational Model
Relational Database Design by ER- and EER-to- Relational Mapping
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 4: Part B Logical Database Design and the Relational Model
Entity-Relationship Model
Tables and Their Characteristics
Database Design – Lecture 4
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
Relational Database Design by ER- and EER-to-Relational Mapping
Relational Database Design by ER- and EERR-to-Relational Mapping
Relational Database Design by ER-to-Relational Mapping
Data Models.
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.
Translation of ER-diagram into Relational Schema
CS 174: Server-Side Web Programming February 12 Class Meeting
Relational Model and ER Model: in a Nutshell
Order Database – ER Diagram
ERD’s REVIEW DBS201.
Relational Database.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Relational Database Design by ER- and EER-to-Relational Mapping
Session 2 Welcome: The seventh learning sequence
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
From data needs to ER Model to relational DB Schema
Review of Week 1 Database DBMS File systems vs. database systems
Relational Database Design by ER- and EER-to-Relational Mapping
Chapter 3: Modeling Data in the Organization
Chengyu Sun California State University, Los Angeles
Relational Database Design by ER- and EER-to- Relational Mapping
Entity-Relationship Diagram (ERD)
Mapping an ERD to a Relational Database
Chapter (7) ER-to-Relational Mapping, and other Relational Languages
Relational Database Design by ER-to-Relational Mapping
Presentation transcript:

DBMS ER-Relational Mapping www.hndit.com DBMS ER-Relational Mapping Week 7-8

ER-Relational Mapping www.hndit.com ER-Relational Mapping

ER to Relational Mapping… www.hndit.com 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 www.hndit.com 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) www.hndit.com Entity Any object about which data is stored Relation 2-d table to implement storage of data abut entities Attribute A property of an entity; stored as a column in a table Entity Instance A row (tuple) in a table (relation) A Key The use of an attribute to identify specific instances within a table

Core Concepts (Review) www.hndit.com Candidate Key Any attribute that uniquely identifies each row in a table Primary Key An 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 Key An 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.) www.hndit.com ER to Relational Mapping… (contd.) ER Model Relational Model Entity (strong)  Relation For example, ARTIST ARTIST

ER to Relational Mapping… (contd.) www.hndit.com ER to Relational Mapping… (contd.) ER Model Relational Model Simple Attributes  Attributes For example, name ARTIST ARTIST name

ER to Relational Mapping… (contd.) www.hndit.com ER to Relational Mapping… (contd.) ER Model Relational Model Primary Key  Primary Key For example, ARTIST ARTIST name name

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

Rules to Convert (ER – Tables) www.hndit.com 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

www.hndit.com Conversion

www.hndit.com Conversion FK

www.hndit.com Conversion FK FK

ER to Relational Mapping… (contd.) www.hndit.com ER to Relational Mapping… (contd.) ER Model Relational Model Multivalued attribute  Relation & Foreign Key For example, id ART-OBJECT ART-OBJECT id material MATERIALS id materials

ER to Relational Mapping… (contd.) www.hndit.com ER Model Relational Model N-ary relationship “Relationship” relation and n foreign keys For example, B A pkB pkA A C B D r R pkA pkB pkC pkD C D pkC pkD

ER to Relational Mapping… (contd.) www.hndit.com ER to Relational Mapping… (contd.) ER Model Relational Model Weak Entity Relations and combination of partial and primary keys N 1 Policy DEPENDENTS EMPLOYEE name age id

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

Mapping - Summary ER Model Relational Model www.hndit.com Mapping - Summary ER Model Relational 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

www.hndit.com Your Turn

Use the rules introduced to build a set of tables www.hndit.com 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