Part ( PartNum, Description, OnHand, Class, Warehouse, Price,

Slides:



Advertisements
Similar presentations
Database Design DB Chapter 5 J.G. Zheng June 29th 2005.
Advertisements

Database Design J.G. Zheng May 19 th Overview Entity Relationship Modeling Data modeling using Entity Relationship Diagram (ERD) Transforming.
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
Normalisation.
Multiple Table Queries
Concepts of Database Management Seventh Edition
4/30/2015 Database Design:Normalization. 4/30/2015 Functional Dependence An attribute (column) B, is functionally dependent on another attribute A if.
Example 18 SELECT count(*) FROM Part WHERE Class="HW";
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
Structured Query Language STAT 598 W Lecture 27. Outline  Introduction to SQL & MySQL  Single table Queries –Using computed columns –Using special operators:
DBS201: Merging 3NF Tables Lecture 7.
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.
SQL – Part II Yong Choi School of Business CSU, Bakersfield.
Concepts of Database Management, 4th Edition, Pratt & Adamski
1 6 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 6 Database Design 2: Design Methodology.
SQL – Part II Yong Choi School of Business CSU, Bakersfield.
1 5 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 5 Database Design: Normalization.
Concepts of Database Management Sixth Edition
1 5 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 5 Database Design 1: Normalization.
SQL (Standard Query Language) Yong Choi School of Business CSU, Bakersfield.
Normalization Quiz Tao Li Grant Horntvedt. 1. Which of the following statements is true: a. Normal forms can be derived by inspecting the data in various.
DBSQL 4-1 Copyright © Genetic Computer School 2009 Chapter 4 Database Design.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 3 Objectives: Identifying and Eliminating Database.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
Concepts of Database Management, Fifth Edition Chapter 4: The Relational Model 3: Advanced Topics.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
SQL – Part II Yong Choi School of Business CSU, Bakersfield.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
This presentation prepared for MIS 421 / MBA 575 at Western Washington University. Material in this presentation drawn from Richard T. Watson, Data Management:
Avoiding Database Anomalies
Normalization - Mr. Ahmad Al-Ghoul Data Design. 2 learning Objectives  Explain the concept of table design  Explain unnormalized design and the first.
Concepts of Database Management Sixth Edition Chapter 5 Database Design 1: Normalization.
Concepts of Database Management, Fifth Edition
1 A Guide to MySQL 2 Database Design Fundamentals.
資料庫正規化 Database Normalization 取材自 AIS, 6 th edition By Gelinas et al.
Chapter 5: Normalizing the DB. What to do with a bad database structure? How do we determine the right structure? How do we determine primary keys? Normalization.
Switch off your Mobiles Phones or Change Profile to Silent Mode.
1 A Guide to MySQL 2 Database Design Fundamentals.
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 Seventh Edition
PMIT-6102 Advanced Database Systems By- Jesmin Akhter Assistant Professor, IIT, Jahangirnagar University.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 04 – 05 – 2005.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Normalization Hour1,2 Presented & Modified by Mahmoud Rafeek Alfarra.
DO NOT COPY --CONFIDENTIAL Homework 5 Partial Key Star Diagrams & Data Warehouse Design BCIS 4660 Dr. Nick Evangelopoulos Spring 2012.
IST 220 – Intro to DB Lecture 4 Database Design thru ER Modeling.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer.
Southern Methodist University CSE CSE 2337 Introduction to Data Management Chapter 5 Part II.
Normalization ACSC 425 Database Management Systems.
ITD1312 Database Principles Chapter 4C: Normalization.
2/170 ( Premiere Products ). Invoice (InvoiceNum, CustomerNum, LastName, FirstName, Street, City, State, Zip, Date, (PartNum, Description, Price, NumShipped.
Logical Database Design and Relational Data Model Muhammad Nasir
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
1 First Normal Form (1NF) Unnormalized table : Contains a repeating group –Eg: from multi-valued attributes –Eg: from many-many relationship Table in 1NF:
A Guide to SQL, Eighth Edition
Database, tables and normal forms
A Guide to SQL, Eighth Edition
Concepts of Database Management Seventh Edition
Concepts of Database Management Eighth Edition
Normalization – Part II
Example 2 SELECT Customernum, CustomerName, Balance FROM Customer;
Yong Choi School of Business CSU, Bakersfield
Yong Choi School of Business CSU, Bakersfield
Yong Choi School of Business CSU, Bakersfield
Chapter 14 Normalization Pearson Education © 2009.
Presentation transcript:

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice )

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) This table is quite meaningful from the user point of view. It describes the actual operation---as reflected by the database.

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) This table is quite meaningful from the user point of view. It describes the actual operation---as reflected by the database. But what if we have a part that has not been ordered yet?

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) In that case we need to work on the table and change it. The structure should be such that update anomalies are not present. But what if we have a part that has not been ordered yet?

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) Let’s determine functional dependencies. But what if we have a part that has not been ordered yet?

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) PartNum determines: Description OnHand Class WareHouse Price

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) PartNum determines: Description OnHand Class WareHouse Price

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) OrderNum determines: OrderDate CustomerNum

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) OrderNum determines: OrderDate CustomerNum

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) CustomerNum determines: CustomerName RepNum

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) CustomerNum determines: CustomerName RepNum

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) CustomerNum determines: CustomerName RepNum which determines LastName FirstName

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice )

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice )

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) There’s also (PartNum, OrderNum)

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) There’s also (PartNum, OrderNum) which determines NumOrdered

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) There’s also (PartNum, OrderNum) which determines NumOrdered and QuotedPrice

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) So now what do we do?

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) 1. Normalize the table (it has repeating groups).

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies.

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Part ( PartNum, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice ) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Part ( PartNum, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, ) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Part ( PartNum, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, ) Rep (RepNum, LastName, FirstName) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Part ( PartNum, OrderNum, OrderDate, CustomerNum, ) Customer (CustomerNum, CustomerName, RepNum) Rep (RepNum, LastName, FirstName) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Part ( PartNum, OrderNum, OrderDate, CustomerNum, ) Customer (CustomerNum, CustomerName, RepNum) Rep (RepNum, LastName, FirstName) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Orders ( OrderNum, OrderDate, CustomerNum, ) Customer (CustomerNum, CustomerName, RepNum) Rep (RepNum, LastName, FirstName) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice) 1. Normalize the table (it has repeating groups). 2. Eliminate partial dependencies. 3. Make sure the only determinants are candidate keys.

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Orders (OrderNum, OrderDate, CustomerNum ) Customer (CustomerNum, CustomerName, RepNum) Rep (RepNum, LastName, FirstName) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice)

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Orders (OrderNum, OrderDate, CustomerNum ) Customer (CustomerNum, CustomerName, RepNum) Rep (RepNum, LastName, FirstName) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice)

Parts (PartNum, Description, OnHand, Class, Wartehouse, Price) Orders (OrderNum, OrderDate, CustomerNum ) End of story… Customer (CustomerNum, CustomerName, RepNum) Rep (RepNum, LastName, FirstName) OrderLine (PartNum, OrderNum, NumOrdered, QuotedPrice)

Second problem: (Henry Books Case Problem One)

Using the types of entities found in the Henry Books database (books, authors, publishers), create an example of a table that is in first normal form but not in second normal form and an example of a table that is in second normal form but not in third normal form. In each case, justify your answer…

Using the types of entities found in the Henry Books database (books, authors, publishers), create an example of a table that is in first normal form but not in second normal form and an example of a table that is in second normal form but not in third normal form. In each case, justify your answer… This is an example about the power of assumptions.

Using the types of entities found in the Henry Books database (books, authors, publishers), create an example of a table that is in first normal form but not in second normal form and an example of a table that is in second normal form but not in third normal form. In each case, justify your answer… This is an example about the power of assumptions. Take this table: (ISBN, AuthorSSN, AuthorName)

Using the types of entities found in the Henry Books database (books, authors, publishers), create an example of a table that is in first normal form but not in second normal form and an example of a table that is in second normal form but not in third normal form. In each case, justify your answer… This is an example about the power of assumptions. Take this table: (ISBN, AuthorSSN, AuthorName) If we assume that a book can only have one author (that's pretty restrictive, but think about semester projects where group work is not allowed) then the above table is in 2NF already (ISBN is the key) but not in 3NF because of AuthorSSN being a non-key determinant (of whom?)

Using the types of entities found in the Henry Books database (books, authors, publishers), create an example of a table that is in first normal form but not in second normal form and an example of a table that is in second normal form but not in third normal form. In each case, justify your answer… This is an example about the power of assumptions. Take this table: (ISBN, AuthorSSN, AuthorName) If we relax the requirement, and allow co-authors, then the table is no longer in 2NF. That's because we need to include the AuthorSSN column in the key and the functional dependency (AuthorSSN AuthorName) becomes a partial dependency; it was about the existence of non-key determinants in the other context

Part (PartNum, Description, OnHand, Class, Warehouse, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice )

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice )

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice )

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum NumOrdered, QuotedPrice ) Rep (RepNum, LastName, FirstName)

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum NumOrdered, QuotedPrice ) Rep (RepNum, LastName, FirstName)

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, OrderDate, CustomerNum, CustomerName NumOrdered, QuotedPrice ) Customer (CustomerName, RepNum) Rep (RepNum, LastName, FirstName)

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, OrderDate, CustomerNum, NumOrdered, QuotedPrice ) Customer (CustomerName, RepNum) Rep (RepNum, LastName, FirstName)

Part ( PartNum, Description, OnHand, Class, Warehouse, Price, OrderNum, NumOrdered, QuotedPrice ) Orders (OrderNum, OrderDate, CustomerNum) Customer (CustomerName, RepNum) Rep (RepNum, LastName, FirstName)

Part ( PartNum, OrderNum, NumOrdered, QuotedPrice ) Parts (PartNum, Description, OnHand, Class, Warehouse, Price) Orders (OrderNum, OrderDate, CustomerNum) Customer (CustomerName, RepNum) Rep (RepNum, LastName, FirstName)

Part ( PartNum, OrderNum, NumOrdered, QuotedPrice ) Parts (PartNum, Description, OnHand, Class, Warehouse, Price) Orders (OrderNum, OrderDate, CustomerNum) Customer (CustomerName, RepNum) Rep (RepNum, LastName, FirstName)

OrderLine ( PartNum, OrderNum, NumOrdered, QuotedPrice ) Parts (PartNum, Description, OnHand, Class, Warehouse, Price) Orders (OrderNum, OrderDate, CustomerNum) Customer (CustomerName, RepNum) Rep (RepNum, LastName, FirstName)

OrderLine ( PartNum, OrderNum, NumOrdered, QuotedPrice) Parts (PartNum, Description, OnHand, Class, Warehouse, Price) Orders (OrderNum, OrderDate, CustomerNum) Customer (CustomerName, RepNum) Rep (RepNum, LastName, FirstName)