Chapter 14 Normalization Pearson Education © 2009.

Slides:



Advertisements
Similar presentations
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
Advertisements

First Normal Form Second Normal Form Third Normal Form
1 Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Normalization I.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
1 Minggu 10, Pertemuan 19 Normalization (cont.) Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
Part ( PartNum, Description, OnHand, Class, Warehouse, Price,
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.
DBSQL 4-1 Copyright © Genetic Computer School 2009 Chapter 4 Database Design.
Lecture 12 Inst: Haya Sammaneh
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
Chapter 6 Normalization 正規化. 6-2 In This Chapter You Will Learn:  更動異常  How tables that contain redundant data can suffer from update anomalies ( 更動異常.
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. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
Chapter 13 Normalization Transparencies. 2 Last Class u Access Lab.
Concepts of Database Management Sixth Edition Chapter 5 Database Design 1: Normalization.
Concepts of Database Management, Fifth Edition
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
1 A Guide to MySQL 2 Database Design Fundamentals.
1 Pertemuan 23 Normalisasi Matakuliah: >/ > Tahun: > Versi: >
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
Normalization Transparencies
CSC271 Database Systems Lecture # 28.
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.
Chapter 13 Normalization © Pearson Education Limited 1995, 2005.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 13 Normalization Transparencies Last Updated: 08 th May 2011 By M. Arief
Chapter 10 Normalization Pearson Education © 2009.
Normalization Transparencies 1. ©Pearson Education 2009 Objectives How the technique of normalization is used in database design. How tables that contain.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u How to undertake process of normalization. u How to identify most commonly used normal.
Lecture Nine: Normalization
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Normalization. Overview Earliest  formalized database design technique and at one time was the starting point for logical database design. Today  is.
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.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
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 CS490 Database Management Systems. 2 CS490 Database Normalization.
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
Normalization.
Normalization (Database Design)
A Guide to SQL, Eighth Edition
Database, tables and normal forms
SEEM3430: Information Systems Analysis and Design
Normalization DBMS.
MIS 322 – Enterprise Business Process Analysis
Chapter 14 Normalization
CHAPTER 5 Normalization Of Database Tables (Part II: The Process)
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Concepts of Database Management Eighth Edition
System Analysis and Design
Chapter 14 & Chapter 15 Normalization Pearson Education © 2009.
Normalization – Part II
ITS232 Introduction To Database Management Systems
Normalization Dale-Marie Wilson, Ph.D..
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Chapter 14 Normalization.
Normalization February 28, 2019 DB:Normalization.
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Presentation transcript:

Chapter 14 Normalization Pearson Education © 2009

Normalization And Database Design Normalization: is a technique for producing a set of suitable relations that support the data requirements of an enterprise. Characteristics of a suitable set of relations include: the minimal number of attributes necessary to support the data requirements of the enterprise; attributes with a close logical relationship are found in the same relation; minimal redundancy with each attribute represented only once with the important exception of attributes that form all or part of foreign keys. Pearson Education © 2009

The Process of Normalization Normalization is a formal technique for analyzing relations based on their primary key (or candidate key) and functional dependencies. Normalization executed as a series of steps. As normalization proceeds, the relations become progressively: more restricted (stronger) in format less vulnerable to update anomalies Pearson Education © 2009

The Process of Normalization 1NF 2NF 3NF BCNF Less vulnerable to update anomalies Stronger in format 4NF 5NF Higher Normal Form Normalization

The Process of Normalization Pearson Education © 2009

Normalization 1 NF Better than unnormalized 2 NF Better than 1 NF 3 NF

Unnormalized Form (UNF) A table that contains one or more repeating groups. To create an unnormalized table Transform the data from the information source (e.g. form) into table format with columns and rows. Pearson Education © 2009

Unnormalized Form (UNF) ORDER_NUM ORDER _DATE PART_NUM DESCRIPTION NUM_ ORDERD QUOTED_ PRICE 21608 10/20/2010 AT94 Iron 11 21.95$ 21610 DR93 DW11 Gas Range Washer 1 495.00$ 399.99$ 21613 10/21/2010 KL62 Dryer 4 329.95$ 21614 KT03 Dishwasher 2 595.00$ 21617 10/23/2010 BV06 CD52 Home Gym Microwave Oven 12.95$ 150.00$ 21619 21623 KV29 Treadmill 325.99$

First Normal Form (1NF) A relation in which the intersection of each row and column contains one and only one value. Pearson Education © 2009

UNF to 1NF Nominate an attribute or group of attributes to act as the key for the unnormalized table. Identify the repeating group(s) in the unnormalized table which repeats for the key attribute(s). Pearson Education © 2009

UNF to 1NF Remove the repeating group by: 1- ‘flattening’ the table: Entering appropriate data into the empty columns of rows containing the repeating data. Primary key becomes the combination of primary key and redundant value. Disadvantage: introduce redundancy in the relation. Pearson Education © 2009

UNF to 1NF Order Order data convert to first normal form by flatting ORDER_NUM ORDER _DATE PART_NUM DESCRIPTION NUM_ ORDERD QUOTED_ PRICE 21608 10/20/2010 AT94 Iron 11 21.95$ 21610 DR93 Gas Range 1 495.00$ DW11 Washer 399.99$ 21613 10/21/2010 KL62 Dryer 4 329.95$ 21614 KT03 Dishwasher 2 595.00$ 21617 10/23/2010 BV06 Home Gym 12.95$ CD52 Microwave Oven 150.00$ 21619 21623 KV29 Treadmill 325.99$ Order data convert to first normal form by flatting

UNF to 1NF Remove the repeating group by: 2- By placing the repeating data, along with a copy of the original key attribute(s), in separate relation. The Primary key for the new relation is the combination of original primary key and redundant value. Pearson Education © 2009

UNF to 1NF Order_Part Order Order data convert to first normal form ORDER_NUM PART_NUM DESCRIPTION NUM_ ORDERD QUOTED_ PRICE 21608 AT94 Iron 11 21.95$ 21610 DR93 Gas Range 1 495.00$ DW11 Washer 399.99$ 21613 KL62 Dryer 4 329.95$ 21614 KT03 Dishwasher 2 595.00$ 21617 BV06 Home Gym 12.95$ CD52 Microwave Oven 150.00$ 21619 21623 KV29 Treadmill 325.99$ ORDER_NUM ORDER _DATE 21608 10/20/2010 21610 21613 10/21/2010 21614 21617 10/23/2010 21619 21623 Order data convert to first normal form by placing the repeating data, in separate relation

Second Normal Form (2NF) Based on the concept of full functional dependency and composite PK. Full functional dependency indicates that if A and B are attributes of a relation, B is fully dependent on A if B is functionally dependent on A but not on any proper subset of A. Pearson Education © 2009

Second Normal Form (2NF) A relation that is in 1NF and every non-primary-key attribute is fully functionally dependent on the primary key. Pearson Education © 2009

Second Normal Form (2NF) ORDER_NUM ORDER _DATE PART_NUM DESCRIPTION NUM_ ORDERD QUOTED_ PRICE 21608 10/20/2010 AT94 Iron 11 21.95$ 21610 DR93 Gas Range 1 495.00$ DW11 Washer 399.99$ 21613 10/21/2010 KL62 Dryer 4 329.95$ 21614 KT03 Dishwasher 2 595.00$ 21617 10/23/2010 BV06 Home Gym 12.95$ CD52 Microwave Oven 150.00$ 21619 21623 KV29 Treadmill 325.99$ Any problem with updating Part number DR93? – Need to update 2 rows inconsistent data? Any problem if I add new row for the Part DR93, but the description is Gas Iron, or miss-spill the correct description? Deleting row? What if you delete the order #21608 what will happen for the part AT94, will get deleted as well (loss information) Insert new part number but without any order details? Can you do that? Therefore, so many problem with this tables?? We need to make it in the second normal form Is this Table in First Normal Form? (any repeating groups) Is this table in the Second Normal Form? (what is the PK)

Second Normal Form (2NF) ORDERS (ORDER_NUM, ORDER_DATE, PART_NUM, DESCRPTION, NUM_ORDERED, QUOTED_PRICE) It contains the following functional dependencies: ORDER_NUMORDER_DATE PART_NUM  DESCRPTION ORDER_NUM, PART_NUM  NUM_ORDERED , QUOTED_PRICE , ORDER_DATE , DESCRPTION

1NF to 2NF Identify the primary key for the 1NF relation. Identify the functional dependencies in the relation. If partial dependencies exist on the primary key remove them by placing them in a new relation along with a copy of their determinant. A 1NF relation with a primary key that is a single field is in 2NF automatically A relation is in second normal form (2NF) if it is in 1NF and no nonkey attribute is dependent on only a portion of the primary key or … All nonkey attributes are functionally dependent on the entire primary key Pearson Education © 2009

1NF to 2NF If partial dependencies exist on the primary key remove them by placing them in a new relation along with a copy of their determinant. ( ORDER_NUM, (PART_NUM, (ORDER_NUM, PART_NUM, How to complete the above relations??

Second Normal Form (2NF) ( ORDER_NUM, ORDER_DATE) (PART_NUM, DESCRIPTION) (ORDER_NUM, PART_NUM, NUM_ORDERED, QUOTED_PRICE)

1NF to 2NF ORDER_NUM ORDER _DATE PART_NUM DESCRIPTION NUM_ ORDERD QUOTED_ PRICE 21608 10/20/2010 AT94 Iron 11 21.95$ 21610 DR93 Gas Range 1 495.00$ DW11 Washer 399.99$ 21613 10/21/2010 KL62 Dryer 4 329.95$ 21614 KT03 Dishwasher 2 595.00$ 21617 10/23/2010 BV06 Home Gym 12.95$ CD52 Microwave Oven 150.00$ 21619 21623 KV29 Treadmill 325.99$ ORDER_NUM ORDER _DATE 21608 10/20/2010 21610 21613 10/21/2010 21614 21617 10/23/2010 21619 21623 PART_NUM DESCRIPTION AT94 Iron DR93 Gas Range DW11 Washer KL62 Dryer KT03 Dishwasher BV06 Home Gym CD52 Microwave Oven KV29 Treadmill ORDER_NUM PART_NUM NUM_ ORDERD QUOTED_ PRICE 21608 AT94 11 21.95$ 21610 DR93 1 495.00$ DW11 399.99$ 21613 KL62 4 329.95$ 21614 KT03 2 595.00$ 21617 BV06 12.95$ CD52 150.00$ 21619 21623 KV29 325.99$

Third Normal Form (3NF) Based on the concept of transitive dependency. Transitive Dependency is a condition where A, B and C are attributes of a relation such that if A  B and B  C, then C is transitively dependent on A through B. (Provided that A is not functionally dependent on B or C). Pearson Education © 2009

Third Normal Form (3NF) A relation that is in 1NF and 2NF and in which no non-primary-key attribute is transitively dependent on the primary key. Pearson Education © 2009

Third Normal Form (3NF) Is this table in Second Normal Form? Does it have any functional dependency?

Third Normal Form (3NF) CUSTOMER (CUSTOMER_NUM, CUSTOMER_NAME, BALANCE, CREDIT_LIMIT, REP_NUM, LAST_NAME, FIRST_NAME) Functional dependencies: CUSTOMER_NUM CUSTOMER_NAME, BALANCE, CREDIT_LIMIT, REP_NUM, LAST_NAME, FIRST_NAME REP_NUM LAST_NAME, FIRST_NAME

2NF to 3NF Identify the primary key in the 2NF relation. Identify functional dependencies in the relation. If transitive dependencies exist on the primary key remove them by placing them in a new relation along with a copy of their dominant. The Primary key for the new relation is the determinant. Pearson Education © 2009

Third Normal Form (continued)

Third Normal Form (3NF) CUSTOMER (CUSTOMER_NUM, CUSTOMER_NAME, BALANCE, CREDIT_LIMIT, REP_NUM) REP (REP_NUM, LAST_NAME, FIRST_NAME)