Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.

Slides:



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

Chapter 5 Normalization of Database Tables
5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Chapter 5 Normalization of Database Tables
 Definition  Components  Advantages  Limitations Contents  Definition Definition  Normal Forms Normal Forms  First Normal Form First Normal Form.
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
Normal Forms By Christopher Archibald October 16 th 2007.
Lossless Decomposition (2) Prof. Sin-Min Lee Department of Computer Science San Jose State University.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 8 A First Course in Database Systems.
Chapter 8 Normal Forms Based on Functional Dependencies Deborah Costa Oct 18, 2007.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
Need for Normalization
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
Chapter 3 The Relational Model and Normalization
Lecture 12 Inst: Haya Sammaneh
SQL Normalization Database Design Lecture 5. Copyright 2006Page 2 SQL Normalization Database Design 1 st Normal Form 1 st Normal Form 2 nd Normal Form.
Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Chapter 3 Database Normalization 1.
Fundamentals, Design, and Implementation, 9/e. Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/2 Copyright.
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Concepts of Database Management, Fifth Edition
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
The Relational Model and Normalization R. Nakatsu.
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
Design Theory for Relational Databases 2015, Fall Pusan National University Ki-Joune Li.
By Abdul Rashid Ahmad. E.F. Codd proposed three normal forms: The first, second, and third normal forms 1NF, 2NF and 3NF are based on the functional dependencies.
Lecture No 14 Functional Dependencies & Normalization ( III ) Mar 04 th 2011 Database Systems.
1 Functional Dependencies and Normalization Chapter 15.
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Databases : Functional Dependencies 2007, Fall Pusan National University Ki-Joune Li.
Normalization ACSC 425 Database Management Systems.
Objectives of Normalization  To create a formal framework for analyzing relation schemas based on their keys and on the functional dependencies among.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Advanced Database System
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Normalization Or theoretical and common sense approaches to redesigning a database.
Databases : Design of Relational Database Schemas 2007, Fall Pusan National University Ki-Joune Li.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Chapter 3 Database Normalization 1.
4NF & MULTIVALUED DEPENDENCY By Kristina Miguel. Review  Superkey – a set of attributes which will uniquely identify each tuple in a relation  Candidate.
4TH NORMAL FORM By: Karen McVay.
Normalization.
A brief summary of database normalization
Payroll Management System
Normal forms First Normal Form (1NF) Second Normal Form (2NF)
Database Normalization
Design Theory for Relational Databases
Normalization Dale-Marie Wilson, Ph.D..
Normalization.
4 Normal Form.
Normalization February 28, 2019 DB:Normalization.
Sampath Jayarathna Cal Poly Pomona
Chapter 4 The Relational Model and Normalization
Database Management System
Database Design Normalisation (2)
Design Theory for Relational Databases
Presentation transcript:

Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A

Purpose of Normalization To reduce the chances for anomalies to occur in a database. To reduce the chances for anomalies to occur in a database. normalization prevents the possible corruption of databases stemming from what are called "insertion anomalies," "deletion anomalies," and "update anomalies." normalization prevents the possible corruption of databases stemming from what are called "insertion anomalies," "deletion anomalies," and "update anomalies."

Insertion Anomaly A failure to place a new database entry into all the places in the database where that new entry needs to be stored. A failure to place a new database entry into all the places in the database where that new entry needs to be stored. In a properly normalized database, a new entry needs to be inserted into only one place in the database In a properly normalized database, a new entry needs to be inserted into only one place in the database

Deletion Anomaly A failure to remove an existing database entry when it is time to remove that entry. A failure to remove an existing database entry when it is time to remove that entry. In a properly normalized database, an old, to-be-gotten-rid-of entry needs to be deleted from only one place in the database In a properly normalized database, an old, to-be-gotten-rid-of entry needs to be deleted from only one place in the database

Update anomaly An update of a database involves modifications that may be additions, deletions, or both. Thus "update anomalies" can be either of the kinds of anomalies discussed above. An update of a database involves modifications that may be additions, deletions, or both. Thus "update anomalies" can be either of the kinds of anomalies discussed above.

1st Normal Form A table (relation) is in 1NF if A table (relation) is in 1NF if 1. There are no duplicated rows in the table. 2. Each cell is single-valued 3. Entries in a column are of the same kind.

2nd Normal Form A table is in 2NF if it is in 1NF and if all non-key attributes are fully dependent on each candidate key. A table is in 2NF if it is in 1NF and if all non-key attributes are fully dependent on each candidate key. A partial dependency occurs when a non- key attribute is dependent on only a part of the (composite) key A partial dependency occurs when a non- key attribute is dependent on only a part of the (composite) key

1NF but not 2NF Supplier (supplier#, status, city, part#, quantity) Supplier (supplier#, status, city, part#, quantity) –(supplier#, part#) -> quantity –supplier# -> status –supplier# -> city –city -> status => status and city are dependent on just part of the key, namely supplier#. => status and city are dependent on just part of the key, namely supplier#.

1NF but not 2NF (cont ’ d) Decomposition (into 2NF): Decomposition (into 2NF): –Supplier (supplier#, status, city) –Supplier_Part (supplier#, part#, quantity)

3rd Normal Form (3NF) A table is in 3NF if it is in 2NF and if it has no transitive dependencies. A table is in 3NF if it is in 2NF and if it has no transitive dependencies. Transitive dependency is a functional dependency between non-key attributes. Transitive dependency is a functional dependency between non-key attributes.

2NF but not 3NF Supplier (supplier#, status, city) Supplier (supplier#, status, city) –supplier# -> status –supplier# -> city –city -> status => Lacks mutual independence among non-key attributes.

2NF but not 3NF (cont ’ d) Decomposition (into 3NF): Decomposition (into 3NF): –SUPPLIER_CITY (supplier#, city) –CITY_STATUS (city, status)

Boyce-Codd NF A table is in BCNF if it is in 3NF and if every determinant is a candidate key. A table is in BCNF if it is in 3NF and if every determinant is a candidate key. the definition of 3NF does not deal with a relation that: the definition of 3NF does not deal with a relation that: –has multiple candidate keys, where –Those candidate keys are composite, and –the candidate keys overlap (i.e., have at least one common attribute)

3NF but not boyce-codd NF SUPPLIER_PART (supplier#, supplier_name, part#, quantity) SUPPLIER_PART (supplier#, supplier_name, part#, quantity) –Two candidate keys: (supplier#, part#) and (supplier_name, part#) (supplier#, part#) and (supplier_name, part#) –(supplier#, part#) -> quantity –(supplier#, part#) -> supplier_name –(supplier#, part#) -> quantity –(supplier#, part#) -> supplier# –supplier_name -> supplier# –supplier# -> supplier_name

Another example of boyce-codd NF titleyearlengthfilmType studioNam e starName Star Wars colorFoxFisher colorFoxHamill colorFoxFord Mighty Ducks colorDisneyEsteves Wayne ’ s World colorParamountCarvey colorParamountMeyers

Example (cont ’ d) {title, year, starName} as candidate key {title, year, starName} as candidate key title, year  length, filmType, studioName title, year  length, filmType, studioName The above FD (Functional Dependency) violates the BCNF condition because title and year do not determine the sixth attribute, starName The above FD (Functional Dependency) violates the BCNF condition because title and year do not determine the sixth attribute, starName

Example (cont ’ d) We solve this BCNF violation by decomposing relation Movies into We solve this BCNF violation by decomposing relation Movies into 1. The schema with all the attributes of the FD {title, year, length, filmType, studioName} 2. The schema with all attributes of Movies except the three that appear on the right of the FD {title, year, starName}

Summary of Boyce-Codd NF When there is more than one candidate key, a relational table may be in 3NF and anomalies may still result. When there is more than one candidate key, a relational table may be in 3NF and anomalies may still result. This occurs when there is a composite primary key, and there are two equally valid candidates to make up part of this composite primary key. If there is an attribute (one or more columns) on which any other attribute is fully dependent, and this attribute is NOT itself a candidate key, then the table is not in Boyce-Codd Normal form (BCNF). This occurs when there is a composite primary key, and there are two equally valid candidates to make up part of this composite primary key. If there is an attribute (one or more columns) on which any other attribute is fully dependent, and this attribute is NOT itself a candidate key, then the table is not in Boyce-Codd Normal form (BCNF). We fix this by breaking the table up into two tables, both in BCNF. We fix this by breaking the table up into two tables, both in BCNF.