Database Design – Lecture 7

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

Chapter 5 Normalization of Database Tables
Assignment Design Methodology A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the.
Database Lecture Notes Mapping ER Diagrams to Tables 2 Dr. Meg Murray
The Relational Database Model – some relations you might want to avoid!!!
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
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.
Entity-Relationship Model and Diagrams (continued)
Mapping from E-R Model to Relational Model Yong Choi School of Business CSUB.
Database Systems: Design, Implementation, & Management, 5 th Edition, Rob & Coronel 1 Data Models: Degrees of Data Abstraction l Modified ANSI/SPARC Framework.
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.
BTM 382 Database Management Chapter 4: Entity Relationship (ER) Modeling Chitu Okoli Associate Professor in Business Technology Management John Molson.
Mapping ERM to relational database
DBS201: Entity Relationship Diagram
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Mapping from Data Model (ERD) to Relational Model Yong Choi School of Business CSUB.
DATA MODELING AND DATABASE DESIGN
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
DBS201: Relational Databases. Agenda Entity Relationship Model Discovering Attributes Identifying Keys Defining Relationships Relational Model.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Conceptual Data Modeling, Entity Relationship Diagrams
Mapping from Data Model (ERD) to Relational Model
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Database Design Principles – Lecture 3
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
IS 230Lecture 4Slide 1 Entity Relationship to Relational Model Mapping Lecture 5.
CS 370 Database Systems Lecture 9 The Relational model.
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
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)
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
Database Design – Lecture 8
ICOM 5016 – Introduction to Database Systems Lecture 9 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
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 4 Conceptual Data Modeling.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
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.
Week 7-8 DBMS ER-Relational Mapping. ER-Relational Mapping.
DES715 – Database Design Conceptual design. Database Life Cycle Database initial study Database design Implementation Testing Operation Maintenance.
Quiz Where to Store Attributes of Relationship Staff (1) Interviews (0..*) Client Attributes: date, time, comment Staff (StaffNo, …) PK: StaffNo.
Database Design Slide 1 Database Design Lecture 7 part 2 Mapping ERD to Tables.
Database Design Chapter 9 Part-1: Concepts & Foreign Keys 1.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
PRJ566 : Project Planning and Management Converting Class Diagram to Relational Schema.
Chen’s Type Guidance.
Chapter 4: Part B Logical Database Design and the Relational Model
Tables and Their Characteristics
Database Design – Lecture 4
CS 3630 Database Design and Implementation
Logical Data Modeling.
Entity-Relationship Model and Diagrams (continued)
Entity relationship diagrams
Session 2 Welcome: The seventh learning sequence
Review of Week 1 Database DBMS File systems vs. database systems
Chapter 4 Entity Relationship (ER) Modeling
DBMS ER-Relational Mapping
Chapter # 4 Entity Relationship (ER) Modeling.
Presentation transcript:

Database Design – Lecture 7 Converting a Logical ERD to a Relational Model

Lecture Objectives How to convert entities and their relationships from the logical model to the relational model Refining the key structure of an entity Refining relationships between entities based on Business Rules

Converting Entities and Attributes Create a separate table for each entity and consider all the attributes defined as the table columns Verify PK defined in logical model – is it appropriate for table or does another unique (generic) PK need to be defined Remove derived attributes

Converting Entities and Attributes Convert composite attributes to atomic attributes i.e. NAME: convert to FIRST_NAME, LAST_NAME, INITIAL i.e. ADDRESS: convert to STREET, CITY, PROVINCE, POSTAL_CODE

Converting Entities and Attributes Convert multi-valued attributes Approach 1: Within original entity, create several new attributes, one for each of the original multi-valued attribute’s components Can lead to major structural problems in table Approach 2: Create a new entity composed of original multi-valued attribute’s components A 1:M dependent relationship to original table will exist Approach 3: Create a new entity composed of multi-valued attribute’s components A M:N relationship to original table will exist

Converting Entities and Attributes Consider an employee who has multiple skills Approach 1: Create attributes to hold the skill information What if an employee has more than 3 skills?

Converting Entities and Attributes Consider an employee who has multiple skills Approach 2: Create a new entity to hold the attribute’s components Existent dependent because these skills are for this employee and are of no value without the employee

Converting Entities and Attributes What if other employees can have the same skills? Approach 3: Create a new entity to hold the attribute’s components Results in a M:N relationship between EMPLOYEE and SKILL entities which will require a bridge table to be created

Converting Relationships For 1:M connectivity, take the PK of the ‘1’ table and make it an FK in the ‘M’ table For M:N connectivity, create a bridge table Include the PK from each of the original tables as composite PK in the bridge table. These will also be FKs in the bridge table Add additional attributes to the bridge table as required For Strong – Weak Entity relationships, take the PK of the Strong Entity and include it as part of the PK of the Weak Entity. It will also be an FK in the Weak Entity

Example Conversion Given the following ERD, convert to a relational structure using the techniques provided **Note: this ERD is slightly different than last class. Changed to provide more attributes to demonstrate converting to relational tables.

Example Conversion Resulting Tables Might Look Like: CUSTOMER (CUST_NUMBER (PK), CUST_FNAME, CUST_LNAME, CUST_INITIAL, STREET_ADDRESS, CITY, PROVINCE, POSTAL_CODE, HOME_PHONE, DOB) LIBRARIAN (EMPL_ID (PK), LIBR_FNAME, LIBR_LNAME, LIBR_INITIAL) BORROWING_TRANSACTION (TRANS_ID (PK), CUST_ID (FK), EMPL_ID (FK), DATE) BORROWING_DETAIL (TRANS_ID (PK, FK), LINE_NUMBER (PK), BOOK_ID (FK)) CATEGORY (CAT_ID (PK), NAME) BOOK (BOOK_ID (PK), CAT_ID (FK), TITLE, AUTHOR, DESCRIPTION, ISBN)