Presentation is loading. Please wait.

Presentation is loading. Please wait.

Boyce-Codd normal form (BCNF) Kai Zhu CS157B Professor: Dr. Lee.

Similar presentations

Presentation on theme: "Boyce-Codd normal form (BCNF) Kai Zhu CS157B Professor: Dr. Lee."— Presentation transcript:

1 Boyce-Codd normal form (BCNF) Kai Zhu CS157B Professor: Dr. Lee

2 Functional dependency Given a relation R, a set of attributes X in R is said to functionally determine another attribute Y, also in R, if and only if each X value is associated with precisely one Y value. (written X → Y)

3 Normalization Normalization is the process of efficiently organizing data in a database Purpose: 1. Eliminate redundant data 2. Ensure data dependencies make sense


5 1NF Table faithfully represents a relation and has no repeating groups

6 non-1NF 1NF

7 2NF A 1NF table is in 2NF if and only if none of its non-prime attributes are functionally dependent on a subset of a candidate key. (A non-prime attribute is one that does not belong to any candidate key.)

8 An example of a 1NF table that does not meet 2NF is:

9 Candidate key: {Employee, Skill} The remaining attribute, Current Work Location, is dependent on only part of the candidate key, namely Employee. Therefore the table is not in 2NF.

10 3NF A 2NF table is in 3NF if every non-prime attribute of R is non-transitively dependent (i.e. directly dependent) on every key of R.

11 An example of a 2NF table that fails to meet the requirements of 3NF is: Candidate key: {Tournament, Year}

12 It is not 3NF because the non-prime attribute Winner Date of Birth is transitively dependent on the candidate key {Tournament, Year} via the non- prime attribute Winner.

13 Trivial functional dependency A functional dependency FD: X → Y is called trivial if Y is a subset of X.

14 BCNF Boyce-Codd normal form (or BCNF) is a normal form used in database normalization. A table is in BCNF if and only if for every one of its non-trivial functional dependencies X → Y, X is a superkey—that is, X is either a candidate key or a superset thereof. (Y is not included in X)

15 Consider the following non-BCNF table: The candidate keys of the table are: {Person, Shop Type} {Person, Nearest Shop}

16 It is 3NF, WHY? Recall 3NF prohibits transitive functional dependencies of non-prime attributes on candidate keys. In relation “Nearest shop” table, there are no non-prime attributes: that is, all attributes belong to candidate keys. Therefore the table adheres to both 2NF and 3NF.

17 Why it is not BCNF? The table does not adhere to BCNF because of the dependency Nearest shop → Shop Type, in which the determining attribute (Nearest shop ) is neither a candidate key nor a superset of a candidate key.

18 What we can do if we need a relation to be BCNF?

19 Normalizing…

20 After normalization Candidate keys are {person, shop} and{shop},respectively.

21 Thank you

Download ppt "Boyce-Codd normal form (BCNF) Kai Zhu CS157B Professor: Dr. Lee."

Similar presentations

Ads by Google