Boyce-Codd Normal Form By: Thanh Truong. Boyce-Codd Normal Form Eliminates all redundancy that can be discovered by functional dependencies But, we can.

Slides:



Advertisements
Similar presentations
Schema Refinement: Normal Forms
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Normalization 1 Instructor: Mohamed Eltabakh Part II.
Normalization Decomposition techniques for ensuring: Lossless joins Dependency preservation Redundancy avoidance We will look at some normal forms: Boyce-Codd.
Schema Refinement and Normal Forms Given a design, how do we know it is good or not? What is the best design? Can a bad design be transformed into a good.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Dr. Kalpakis CMSC 461, Database Management Systems URL: Relational Database Design.
C.1 Appendix C: Advanced Relational Database Design Reasoning with MVDs Higher normal forms Join dependencies and PJNF DKNF.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Appendix B: Advanced.
©Silberschatz, Korth and Sudarshan Relational Database Design First Normal Form Pitfalls in Relational Database Design Functional Dependencies Decomposition.
7.1 Chapter 7: Relational Database Design. 7.2 Chapter 7: Relational Database Design Features of Good Relational Design Atomic Domains and First Normal.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Functional Dependency CS157a Sec. 2 Koichiro Hongo.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Relational Database Design - part 2 - Database Management Systems I Alex Coman,
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
Functional Dependencies (Part 3) Presented by Nash Raghavan All page numbers are in reference to Database System Concepts (5 th Edition)
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Relational Database Design Theory Lecture 6. The Banking Schema branch = (branch_name, branch_city, assets) customer = (customer_id, customer_name, customer_street,
1 Schema Refinement and Normal Forms Chapter 19 Raghu Ramakrishnan and J. Gehrke (second text book) In Course Pick-up box tomorrow.
Multivalued Dependency Tamer Abuelata. Introduction Goal in Databases: Goal in Databases: BCNF (Boyce Codd Normal Form) BCNF (Boyce Codd Normal Form)
Department of Computer Science and Engineering, HKUST Slide 1 7. Relational Database Design.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
Relational Database Design
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 7: Relational Database Design.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2 Chapter 7: Relational Database Design First Normal Form Goals of Relational.
Chapter 7: Relational Database Design. 7.2Unite International CollegeDatabase Management Systems Chapter 7: Relational Database Design Features of Good.
 Features of Good Relational Design  Atomic Domains and First Normal Form  Decomposition Using Functional Dependencies  Functional Dependency Theory.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Chapter 7: Relational Database Design. 7.2Unite International CollegeDatabase Management Systems Chapter 7: Relational Database Design Features of Good.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design Pitfalls in.
Relational Database Design by Relational Database Design by Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING.
Database System Concepts, 5 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Relational.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
Functional Dependencies and Normalization 1 Instructor: Mohamed Eltabakh
Computing & Information Sciences Kansas State University Wednesday, 04 Oct 2006CIS 560: Database System Concepts Lecture 17 of 42 Wednesday, 04 October.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational Database.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Appendix B: Advanced.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Chapter 7: Relational Database Design
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
© 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.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
Computing & Information Sciences Kansas State University Friday, 03 Oct 2007CIS 560: Database System Concepts Lecture 16 of 42 Wednesday, 03 October 2007.
Database System Concepts, 5th Ed. Bin Mu at Tongji University Chapter 7: Relational Database Design.
Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.
Relational Database Design
Relational Database Design by Dr. S. Sridhar, Ph. D
Chapter 7: Relational Database Design
Relational Database Design
CS 480: Database Systems Lecture 22 March 6, 2013.
Functional Dependencies and Normalization
Module 5: Overview of Normalization
Chapter 7: Relational Database Design
Boyce-Codd Normal Form (BCNF)
Designing Relational Databases
Chapter 7a: Overview of Database Design -- Normalization
Functional Dependencies and Normalization
Functional Dependencies and Normalization
Presentation transcript:

Boyce-Codd Normal Form By: Thanh Truong

Boyce-Codd Normal Form Eliminates all redundancy that can be discovered by functional dependencies But, we can create a normal form more restrictive called 4NF

Definition A relation schema R is in BCNF with respect to a set F if: For all functional dependencies of F of the form , where  R and  R  is a trivial functional dependency(  )  is a superkey for schema R A database design is in BCNF if each member of the set of relational schemas that constitute the design is in BCNF

Rule for schema not in BCNF Let R be a schema not in BCNF, then there is at least one nontrivial functional dependency  such that  is not a superkey

Example of not BCNF bor_loan = (customer_id, loan_number, amount) loan_number  amount but loan_number is not a superkey

BCNF Decomposition The definition of BCNF can be used to directly test if a relationship is in BCNF If a relation is not in BCNF it can be decomposed to create relations that are in BCNF

Example borrower = (customer_id, load_number) Is BCNF because no nontrivial functional dependency hold onto it loan = (loan_number, amount) Has one nontrivial functional dependency that holds, loan_number  amount, but loan_number is a superkey so loan is in BCNF

3NF vs BCNF BCNF requires that all nontrivial dependencies be of the form   , where  is a superkey 3NF relaxes this constraint a little bit by allowing nontrivial functional dependencies

Testing for BCNF 1) To check if a nontrivial dependency  causes a violation of BCNF, compute a + (attribute closure of  ), and verify that it includes all attributes of R; that is, is is the superkey of R 2) If we can show that none of the dependencies in F causes a violation of BCNF, then none of the dependencies in F + will cause a violation of BCNF either

Alternate test for 2) For every subset  of attributes in R i check that a + (the attribute closer of  under F ) either includes no attribute of R i - , or includes all attributes of R i

BCNF Decomposition Algorithm If R is not in BCNF, we can decompose R into a collection of BCNF schemas R 1, R 2, …, R n Result := {R}; done := false; computer F + while(not done) do if(there is a schema R i in result that is not in BCNF) then begin  be a nontrivial functional dependency that holds on R i such that  -> R i is not in F +, and   =  ; result :=(result – R i )  (R i -  )  ( ,  ); end else done := true; Pg 289 figure 7.12

Example lending = (branch_name, branch_city, assets, customer_name, loan_number, amount) branch_name  assets branch_city loan_number  amount branch_name candidate key is {loan_number, customer_name} branch_name is not superkey so not in BCNF so lending is not BCNF

Example (cont…) So we replace lending by: branch = (branch_name, branch_city, assets) loan_info = (branch_name, customer_name, loan_number, amount) The only nontrivial functional dependencies that hold on branch include branch_name on the left side of the arrow. Since branch_name is a key for branch, the relation branch is in BCNF

Example (cont…) For loan_info The functional dependency loan_number  amount branch_name holds on loan_info but loan_number is not a key for loan_info, so we replace loan_info by loanb = (loan_number, branch_name, amount) borrower = (customer_name, loan_number) loanb and borrower are in BCNF

3NF pro/con Advantage of 3NF: it is always possible to obtain a 3NF design without sacrificing losslessness or dependency preservation Disadvantage of 3NF: we may have to use null values to represent some of the possible meaningful relationships among data items, and there is the problem of repetition of information

Conclusion Our goals of database design with functional dependencies are 1) BCNF 2) Losslessness 3) Dependency preservation Not possible to get all 3, we have to choose between BCNF or dependency preservation

Source Silberschatz, Korth, Sudarshan (2006). Database System Concepts. New York: McGraw-Hill