Download presentation
Presentation is loading. Please wait.
Published byAlicia Spencer Modified over 9 years ago
1
Chapter 10_part3 Functional Dependencies and Normalization for Relational Databases
2
Introduction to Databases 2 BCNF (Boyce-Codd Normal Form) A relation schema R is in Boyce-Codd Normal Form (BCNF) if whenever an FD X A holds in R, then X is a superkey of R Each normal form is strictly stronger than the previous one: Every 2NF relation is in 1NF Every 3NF relation is in 2NF Every BCNF relation is in 3NF There exist relations that are in 3NF but not in BCNF The goal is to have each relation in BCNF (or 3NF)
3
Introduction to Databases 3 BCNF R1(A,C) R2(C,B)
4
Introduction to Databases 4
5
5 BCNF FDs: {Student,course} Instructor Instructor Course It is in 3NF not in BCNF Decomposing into 2 schemas {Student, Instructor} {Instructor, Course}
6
Introduction to Databases 6 Examples BCNF R ( Client#, Problem, Consultant _name) R1 (Client#, Consultant _name) R2 (Consultant _name, Problem) ■R (Stud#, Class#, Instructor, Grade) R1 (Stud#, Instructor, Grade) R2 (Instructor, Class#)
7
Introduction to Databases 7 Example Consider the following relation for published books: BOOK (Book_title, Author_name, Book_type, Listprice, Author_affil, Publisher) - Author_affil referes to the affiliation of the author. Suppose thefollowing dependencies exist: Book_title -> Publisher, Book_type Book_type -> Listprice Author_name -> Author-affil (a) What normal form is the relation in? Explain your answer. (b) Apply normalization until you cannot decompose the relations further. State the reasons behind each decomposition.
8
Introduction to Databases 8 Answer BOOK (Book_title, Authorname, Book_type, Listprice, Author_affil, Publisher) (a) The key for this relation is (Book_title, Authorname). This relation is in 1NF and not in 2NF as no attributes are Full FD on the key. It is also not in 3NF. (b) 2NF decomposition: Book0(Book_title, Authorname) Book1(Book_title, Publisher, Book_type, Listprice) Book2(Authorname, Author_affil) This decomposition eliminates the partial dependencies. 3NF decomposition: Book0(Book_title, Authorname) Book1-1(Book_title, Publisher, Book_type) Book1-2(Book_type, Listprice) Book2(Authorname, Author_affil) This decomposition eliminates the transitive dependency of Listprice
9
Introduction to Databases 9 Example Given the relation schema Car_Sale (Car#, Salesman#, Date_sold, Commission%, Discount_amt) with the functional dependencies Date_sold -> Discount_amt Salesman# -> Commission% Car# -> Date_sold This relation satisfies 1NF but not 2NF (Car# -> Date_sold and Salesman# -> Commission%) so these two attributes are not Full FD on the primary key and not 3NF
10
Introduction to Databases 10 To normalize, 2NF: Car_Sale1 (Car#, Salesman#) Car_Sale2 (Car#, Date_sold, Discount_amt) Car_Sale3 (Salesman#,Commission%) 3NF: Car_Sale1(Car#, Salesman#) Car_Sale2-1(Car#, Date_sold) Car_Sale2-2(Date_sold, Discount_amt) Car_Sale3(Salesman#,Commission%) Answer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.