DBS201: Merging 3NF Tables Lecture 7.

Slides:



Advertisements
Similar presentations
The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
Advertisements

Normalisation.
4/30/2015 Database Design:Normalization. 4/30/2015 Functional Dependence An attribute (column) B, is functionally dependent on another attribute A if.
BACS 485 Normalization. Data Anomalies WORKER (WORKER-ID, NAME, SKILL-TYPE, SUPV-ID, BLD-ID) WORKER-IDNAMESKILL-TYPESUPV-IDBLD-ID 1235M. FaradayElectric
Order Entry System Please use speaker notes for additional information!
Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model.
Normalisation Ensuring data integrity in database design 1.
E VEN M ORE N ORMALIZATION DBS201. Agenda: 1.Foreign Keys 2.FK Example: Customer and Sales Rep 3. Three ways to detect a Foreign Key 4. Normalization.
Concepts of Database Management Sixth Edition
Accounting 6500 Relational Databases: Accounting Applications Introduction to Normalization.
Normalization A technique for identifying table structures that have potential maintenance problems.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
1 6 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 6 Database Design 2: Design Methodology.
The Relational Database Model:
Normalization A337. A337 - Reed Smith2 Structure What is a database? ◦ Tables of information  Rows are referred to as records  Columns are referred.
Database – Part 2a Dr. V.T. Raja Oregon State University.
Part ( PartNum, Description, OnHand, Class, Warehouse, Price,
Chapter 3 The Relational Model and Normalization
DBSQL 4-1 Copyright © Genetic Computer School 2009 Chapter 4 Database Design.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
Conceptual Design versus Logical Design. Conceptual Data Design Prepared at beginning of project High level view of how the client sees the data Top down.
Database Design Sections 6 & 7 Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies and Recursive relationships.
Copyright  Oracle Corporation, All rights reserved. 4 CMIS Powell Oracle Designer: Creating the Database Design CMIS Powell.
Richard Merritt1 Data Modelling Entities, Attributes and Relationships.
Avoiding Database Anomalies
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Concepts of Database Management Sixth Edition Chapter 5 Database Design 1: Normalization.
1 A Guide to MySQL 2 Database Design Fundamentals.
Switch off your Mobiles Phones or Change Profile to Silent Mode.
BTEC National Extended Diploma1 IT Systems Analysis and Design Entity Relationship Diagrams.
1 A Guide to MySQL 2 Database Design Fundamentals.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification.
BIS 360 – Lecture Eight Ch. 12: Database Design and Normalization.
Customer Order Order Number Date Cust ID Last Name First Name State Amount Tax Rate Product 1 ID Product 1 Description Product 1 Quantity Product 2 ID.
Concepts of Database Management, Fifth Edition Chapter 6: Database Design 2: Design Methodology.
Btec National - Advanced Databases 1 Advanced Databases Entity Relationship Diagrams.
Database Design – Lecture 4 Conceptual Data Modeling.
PMIT-6102 Advanced Database Systems By- Jesmin Akhter Assistant Professor, IIT, Jahangirnagar University.
DATA NORMALIZATION CS 260 Database Systems. Overview  Introduction  Anomalies  Functional dependence  Normal forms  1NF  2NF  3NF  BCNF  Denormalization.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
Logical (Information Level) Design of Relational Databases.
Btec National - IT SYSTEMS ANALYSIS AND DESIGN 1 IT Systems Analysis and Design Entity Relationship Diagrams.
Database Design Chapter 9 Part-1: Concepts & Foreign Keys 1.
DO NOT COPY --CONFIDENTIAL Homework 5 Partial Key Star Diagrams & Data Warehouse Design BCIS 4660 Dr. Nick Evangelopoulos Spring 2012.
1 6 Concepts of Database Management, 5 th Edition, Pratt & Adamski Chapter 6 Database Design 2: Design Methodology Spring 2006.
Concepts of Database Management, Fifth Edition Chapter 6: Database Design 2: Design Methodology.
Southern Methodist University CSE CSE 2337 Introduction to Data Management Chapter 5 Part II.
INFS 6220 Systems Analysis & Design Transactional DBs vs. Data Warehouses.
1 First Normal Form (1NF) Unnormalized table : Contains a repeating group –Eg: from multi-valued attributes –Eg: from many-many relationship Table in 1NF:
1 Database Design Sections 6 & 7 First Normal Form (1NF), Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies.
Normalisation Worked example for an Order Remember : The data should depend upon the key, the whole key and nothing but the key.
Intro to MIS – MGS351 Relational Database Design
A Guide to SQL, Eighth Edition
Chapter 9 Part-1: Concepts & Foreign Keys
SEEM3430: Information Systems Analysis and Design
Database Design – Lecture 4
Implementation of Entity Relationships
Chapter 11 Database Design
Relational Model and ER Model: in a Nutshell
Concepts of Database Management Seventh Edition
DBS201: More on SQL Lecture 2.
Concepts of Database Management Eighth Edition
System Analysis and Design
Chapter 9 Part-1: Concepts & Foreign Keys
Normalization – Part II
Database Systems Instructor Name: Lecture-11.
DBS201: More on SQL Lecture 2.
Chapter 14 Normalization Pearson Education © 2009.
User Views and merging relations & Journaling
Presentation transcript:

DBS201: Merging 3NF Tables Lecture 7

Merging 3NF Tables Bottom up design on a number of similar views (reports/screens) generates a series of tables in 3NF Resulting tables are similar

Premiere Corporation Order Detail Report Merging 3NF Relations View 1 Premiere Corporation Order Detail Report Order Order Cust Part Part Number Quoted Total Number Date Number Number Desc Ordered Price 12489 2001-09-02 124 AX12 Iron 11 14.95 164.45 12491 2001-09-02 311 BT04 GasGrill 1 149.99 149.99 BZ66 Washer 1 399.99 399.99 12494 2001-09-04 315 CB03 Bike 4 279.99 1,119.96 12495 2001-09-04 256 CX11 Blender 2 22.95 45.90 12498 2001-09-05 522 AZ52 Dartboard 2 12.95 25.90 BA74 Basketball 4 24.95 99.80 12500 2001-09-05 124 BT04 GasGrill 1 149.99 149.99 12504 2001-09-05 522 CZ81 Treadmill 2 325.99 651.98

Premiere Corporation Order Detail Report Merging 3NF Relations Given this view sample, working through normalization could give the following 3NF tables Premiere Corporation Order Detail Report Order Order Cust Part Part Number Quoted Total Number Date Number Number Desc Ordered Price 12489 2001-09-02 124 AX12 Iron 11 14.95 164.45 12491 2001-09-02 311 BT04 GasGrill 1 149.99 149.99 BZ66 Washer 1 399.99 399.99 12494 2001-09-04 315 CB03 Bike 4 279.99 1,119.96 12495 2001-09-04 256 CX11 Blender 2 22.95 45.90 12498 2001-09-05 522 AZ52 Dartboard 2 12.95 25.90 BA74 Basketball 4 24.95 99.80 12500 2001-09-05 124 BT04 GasGrill 1 149.99 149.99 12504 2001-09-05 522 CZ81 Treadmill 2 325.99 651.98 ORDER (ORDER_NUM(PK), ORDER_DATE, CUSTOMER_NUM) PART (PART_NUM(PK), PART_DESC, QUOTED_PRICE) ORDER_PART(ORDER_NUM(PK,FK), PART_NUM(PK,FK), NUM_ORDERED)

Merging 3NF Relations View 2 Premiere Corporation Order Detail Report Order Order Cust Last Part Part Qty List Number Date Number Name Number Desc Ordered Price 12489 2001-09-02 124 Adams AX12 Iron 11 14.95 12491 2001-09-02 311 Charles BT04 GasGrill 3 149.99 BZ66 Washer 1 399.99 12494 2001-09-04 315 Daniels CB03 Bike 4 279.99 12495 2001-09-04 256 Samuels CX11 Blender 2 22.95 12498 2001-09-05 522 Nelson AZ52 Dartboard 2 12.95 BA74 Basketbal 4 24.95 12500 2001-09-05 124 Adams BT04 GasGrill 1 149.99 12504 2001-09-05 522 Nelson CZ81 Treadmill 2 325.99

Merging 3NF Relations Given this view sample, working through normalization could give the following 3NF tables Premiere Corporation Order Detail Report Order Order Cust Last Part Part Qty List Number Date Number Name Number Desc Ordered Price 12489 2001-09-02 124 Adams AX12 Iron 11 14.95 12491 2001-09-02 311 Charles BT04 GasGrill 3 149.99 BZ66 Washer 1 399.99 12494 2001-09-04 315 Daniels CB03 Bike 4 279.99 12495 2001-09-04 256 Samuels CX11 Blender 2 22.95 12498 2001-09-05 522 Nelson AZ52 Dartboard 2 12.95 BA74 Basketbal 4 24.95 12500 2001-09-05 124 Adams BT04 GasGrill 1 149.99 12504 2001-09-05 522 Nelson CZ81 Treadmill 2 325.99 ORDER (ORDER_NUM(PK), ORDER_DATE, CUSTOMER_NUM(FK)) CUSTOMER (CUST_NUM(PK, LAST_NAME) PART (PART_NUM(PK), PART_DESC, LIST_PRICE) ORDER_PART(ORDER_NUM(PK,FK), PART_NUM(PK,FK), QTY_ORDERED)

Merging 3NF Relations Resulting 3NF tables from both examples: View 1: ORDER (ORDER_NUM(PK), ORDER_DATE, CUST_NUM) PART (PART_NUM(PK), PART_DESC, QUOTED_PRICE) ORDER_PART(ORDER_NUM(PK,FK), PART_NUM(PK,FK), NUM_ORDERED) Notice most attributes are similarly named Two table ‘PART’, each with a different attribute QUOTED_PRICE and LIST_PRICE. Assuming they represent the same attribute, need to give them a consistent name ORDER (ORDER_NUM(PK), ORDER_DATE, CUST_NUM(FK)) CUSTOMER (CUST_NUM(PK, LAST_NAME) PART (PART_NUM(PK), PART_DESC, LIST_PRICE) ORDER_PART(ORDER_NUM(PK,FK), PART_NUM(PK,FK), QTY_ORDERED) Notice same with QTY_ORDERED and NUM_ORDERED in the ORDER_PART tables

Merging 3NF Relations Resulting Merged set of 3NF tables from both examples: ORDER (ORDER_NUM(PK), ORDER_DATE, CUST_NUM(FK)) PART (PART_NUM(PK), PART_DESC, LIST_PRICE) ORDER_PART(ORDER_NUM(PK,FK), PART_NUM(PK,FK), QTY_ORDERED) CUSTOMER (CUST_NUM(PK, LAST_NAME) Note new name in PART table: LIST_PRICE and new name in ORDER_PART table; QTY_ORDERED

Merging 3NF Relations Another Example - Two tables: Step 1: Merge tables: (Note this table is no longer in 3NF) CUSTOMER (CUST_NUM(PK), CUST_NAME, REP_NUM) CUSTOMER (CUST_NUM(PK), CUST_NAME, REP_LAST_NAME, REP_FIRST_NAME) CUSTOMER (CUST_NUM(PK), CUST_NAME, REP_LAST_NAME, REP_FIRST_NAME, REP_NUM)

Merging 3NF Relations Normalized tables: Normalize the tables: CUSTOMER (CUST_NUM(PK), CUST_NAME, REP_NUM, REP_FIRST_NAME, REP_LAST_NAME) CUSTOMER (CUST_NUM(PK), CUST_NAME, REP_NUM (FK)) REP (REP_NUM(PK), REP_FIRST_NAME, REP_LAST_NAME)

Steps to Merge 3NF Relations Review attribute names of 3NF relations from each user view and make them consistent across all relations Use consistent name for relations with same attributes in primary key (i.e. CUSTOMER table and CLIENT table; both with a primary key of CUST_NUM should have the same relation name) Examine the primary key of each relation with a composite primary key to determine if all parts should be part of the primary key (partial dependencies) Resolve any transitive dependencies if they were created in the previous step Revise ERD as required with one entity for each relation and a relationship for each foreign key Revisit ERD relationships to determine what is option vs mandatory