PRJ566 : Project Planning and Management Converting Class Diagram to Relational Schema.

Slides:



Advertisements
Similar presentations
ER Modeling Case Studies
Advertisements

Entity Relationship (E-R) Modeling Hachim Haddouti
Logical Database Design
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.
Review Database Application Development Access Database Development ER-diagram Forms Reports Queries.
Information Resources Management February 13, 2001.
Mapping from E-R Model to Relational Model Yong Choi School of Business CSUB.
©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.
Ch 6: ER to Relational Mapping
1 Web-Enabled Decision Support Systems Entity-Relationship Modeling Prof. Name Position (123) University Name.
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
Mapping from Data Model (ERD) to Relational Model Yong Choi School of Business CSUB.
DATA MODELING AND DATABASE DESIGN
Geog 495 GIS Database Design Midterm review. Outlines 1.Database Concepts 2.Relational Database 3.Object-oriented Database 4.Entity-Relationship Diagram.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Mapping from Data Model (ERD) to Relational Model
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
SQL Structured Query Language Programming Course.
IS 475/675 - Introduction to Database Design
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 4 Mapping an ER model to tables © Akhilesh Bajaj,
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
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.
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.
Database Design – Lecture 8
Mapping from conceptual model (EER-M)
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
ITEC 3220A Using and Designing Database Systems Instructor: Prof Z. Yang Course Website: 3220a.htm
Entity Relationship Modeling
Database Design – Lecture 4 Conceptual Data Modeling.
Chapter 17 Logical Database Design for the Relational Model Pearson Education © 2009.
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,
Database Design – Lecture 12 Object Oriented Database Design cont’d.
Week 7-8 DBMS ER-Relational Mapping. ER-Relational Mapping.
Database Design – Lecture 7
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Database Design Slide 1 Database Design Lecture 7 part 2 Mapping ERD to Tables.
Database Design. Database Design Process Data Model Requirements Application 1 Database Requirements Application 2 Requirements Application 4 Requirements.
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 2.
Database Design – Lecture 14 Converting an OO Data Model to a Class Diagram.
Entity Modeling Pratt & Adamski, Ch 6. The Pratt and Adamski approach is not a standard MIS view. Design Methodology Data Modeling.
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.
 Includes all modeling concepts of basic ER  Additional concepts: subclasses/superclasses, specialization/generalization,
Relational Database Design by ER- and EER-to- Relational Mapping
Chapter 4: Part B Logical Database Design and the Relational Model
Entity Relationship (E-R) Modeling
Entity-Relationship Model
Logical Database Design for the Relational Model
Tables and Their Characteristics
Database Design – Lecture 4
Assignment 4 Map entities with relationships to relational schemas.
OO models with relational databases
Mapping ER Diagrams to Tables
Order Database – ER Diagram
Database Systems: Design, Implementation, and Management Tenth Edition
Session 2 Welcome: The seventh learning sequence
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Relational Database Design (Top Down)
E-R DIAGRAMS TO RELATIONAL SCHEMA
Chengyu Sun California State University, Los Angeles
DBMS ER-Relational Mapping
Mapping an ERD to a Relational Database
Database Management system
Mapping an ERD to a Relational Database
Presentation transcript:

PRJ566 : Project Planning and Management Converting Class Diagram to Relational Schema

Database Design – Lecture 13 Object Terminology

3 OO Terminology  Simple Object Contains only single-valued attributes and has no attributes that refer to other objects

4 OO Terminology  Associative Object (Intersection Class) An object used to represent a relationship between two or more objects.

5 Steps to Convert from an Class Diagram to Relational 1. Make sure every table has a unique identifier (PK). 2. Simple classes become tables. Identify a unique identifier and make this a primary key. 3. Intersection class becomes a bridge table. 4. Remove derived attributes. 5. For association relationship of 1:M, add the PK of the 1 table as an FK of the M table.

6 Steps to Convert from an Class Diagram to Relational 5. For aggregation/composition relationships: a. Consider weak/strong entity relationships: If a weak relationship (aggregation), add the PK of the aggregate as a FK in the ‘part’ (it will not be part of the PK). If a strong relationship (composition), add the PK of the aggregate as part of a composite primary key of the ‘part’. It will also be a FK.

7 Steps to Convert from an Class Diagram to Relational 6. Inheritance relationship: a. Create a table for the superclass and a table for each of the subclasses (subtype tables). Unique identifier (primary key) for both tables will be the same, or b. Create a table for each subclass (include attributes from superclass in each table), or c. Create one table for the entire structure and create a new attribute to denote which type of subclass it is

8 Steps to Convert from an Class Diagram to Relational 6. Many-to-many associations: a. Create two base tables and a bridge table. The PKs of the base tables will be PK/FKs of the bridge table. 7. Do normalization (if necessary).

9 Steps to Convert from an Class Diagram to Relational Enrolment Example Should be 0..n

10 Steps to Convert from an Class Diagram to Relational Enrolment Example Continued

11 Steps to Convert from an Class Diagram to Relational Person is a supertype entity of Employee, Dependent and Beneficiary Create primary key for each table and convert Tables (option a from rules): PERSON (PERSON_ID (pk), FNAME, LNAME) EMPLOYEE (EMPL_PERSON_ID (pk), SEX, DATEOFBIRTH, ANNUAL_SALARY, ADDRESS) BENEFICIARY (BEN_PERSON_ID (pk)) DEPENDENT (DEP_PERSON_ID (pk), DATEOFBIRTH, RELATIONSHIP)

12 Steps to Convert from an Class Diagram to Relational Connectivity between Person supertype and each subtype (Employee, Dependent and Beneficiary is 1:1) Additional Relationships: EMPLOYEE:BENEFICIARY is M:N (we already identified an intersection table – EMPLOYEE_BENEFICIARY) EMPLOYEE:DEPENDENT is 1:M and is a strong/weak relationship (therefore add PK of 1 as a PK,FK of weak)

13 Steps to Convert from an Class Diagram to Relational Revised Tables: PERSON (PERSON_ID (pk), FNAME, LNAME) EMPLOYEE (EMPL_PERSON_ID (pk), SEX, DATEOFBIRTH, ANNUAL SALARY, ADDRESS) BENEFICIARY (BEN_PERSON_ID (pk)) DEPENDENT (DEP_PERSON_ID (pk), EMPL_PERSON_ID (pk, fk), DATEOFBIRTH, RELATIONSHIP) EMPLOYEE_BENEFICIARY (EMPL_PERSON_ID (pk, fk), BEN_PERSON_ID (pk, fk), PERCENT)

14 Steps to Convert from an Class Diagram to Relational More Tables: PLAN (PLAN_ID (pk), TITLE) CLIENT (CLIENT_ID (pk), ACCOUNT, TITLE, ADDRESS, TELEPHONE, FAX) BENEFIT (BENEFIT_ID (pk), TITLE, PREMIUM_RATE, DESCRIPTION) Relationships: PLAN: BENEFIT M:N (no intersection class on our OODM) Revised Tables: PLAN_BENEFIT (PLAN_ID (pk, fk), BENEFIT_ID (pk, fk))

15 Steps to Convert from an Class Diagram to Relational Enrolment Bridge Table: EMPLOYEE-BENEFIT(EMPL_PERSON_ID (pk, fk)), BENEFIT_ID (pk, fk), ENROLMENT_DATE)

16 Steps to Convert from an OODM to a Rose Model Final Relationships: CLIENT: EMPLOYEE 1:M PLAN: CLIENT 1:M Revised Tables: CLIENT (CLIENT_ID (pk), ACCOUNT, TITLE, ADDRESS, TELEPHONE, FAX, PLAN_ID (fk)) EMPLOYEE (EMPL_PERSON_ID (pk), SEX, DATEOFBIRTH, ANNUAL SALARY, ADDRESS, CLIENT_ID (fk))