14-1 Chapter 14 Functional Dependencies and Normalization for Relational Database.

Slides:



Advertisements
Similar presentations
Functional Dependencies and Normalization for Relational Databases
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
NORMALIZATION. Normalization Normalization: The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations.
Chapter 3 Notes. 3.1 Functional Dependencies A functional dependency is a statement that – two tuples of a relation that agree on some particular set.
Ch 10, Functional Dependencies and Normal forms
Functional Dependencies and Normalization for Relational Databases.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Normalization.
Ms. Hatoon Al-Sagri CCIS – IS Department Normalization.
Functional Dependencies and Normalization for Relational Databases
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
METU Department of Computer Eng Ceng 302 Introduction to DBMS Functional Dependencies and Normalization for Relational Databases by Pinar Senkul resources:
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 8 Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Announcements Homework 1 due Friday. Slip it under my office door (1155) or put in my mailbox on 5 th floor. Program 2 has been graded ;-( Program 3 out.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Functional Dependencies and Normalization for Relational Databases.
FUNCTIONAL DEPENDENCIES. Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 6 NORMALIZATION FOR RELATIONAL DATABASES Instructor Ms. Arwa Binsaleh.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
King Saud University College of Computer & Information Sciences Computer Science Department CS 380 Introduction to Database Systems Functional Dependencies.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
DatabaseIM ISU1 Chapter 10 Functional Dependencies and Normalization for RDBs Fundamentals of Database Systems.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Topic 10 Functional Dependencies and Normalization for Relational Databases Faculty of Information Science and Technology Mahanakorn University of Technology.
Instructor: Churee Techawut Functional Dependencies and Normalization for Relational Databases Chapter 4 CS (204)321 Database System I.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Normalization.
Top-Down Database Design Mini-world Requirements Conceptual schema E1 E2 R Relation schemas ?
Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Chapter Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
1 Functional Dependencies and Normalization Chapter 15.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Lecture 8: Database Concepts May 4, Outline From last lecture: creating views Normalization.
Deanship of Distance Learning Avicenna Center for E-Learning 1 Session - 7 Sequence - 2 Normalization Functional Dependencies Presented by: Dr. Samir Tartir.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Chapter 7 Functional Dependencies Copyright © 2004 Pearson Education, Inc.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Al-Imam University Girls Education Center Collage of Computer Science 1 nd Semester, 1432/1433H Chapter 10_part2 Functional Dependencies and Normalization.
Functional Dependencies and Normalization for Relational Databases 1 Chapter 15 تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Functional Dependencies and Normalization for Relational Databases تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في ذلك. حيث المرجع.
10/3/2017.
10/3/2017.
Functional Dependency and Normalization
CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases.
Functional Dependencies and Normalization for Relational Databases
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Functional Dependencies and Normalization for RDBs
Functional Dependencies and Normalization for Relational Databases
Database Management systems Subject Code: 10CS54 Prepared By:
Normalization.
Chapter Outline 1 Informal Design Guidelines for Relational Databases
Presentation transcript:

14-1 Chapter 14 Functional Dependencies and Normalization for Relational Database

Informal Design Guidelines for Relational Databases 1.1 Semantics of the Relation Attributes 1.2 Redundant Information in Tuples and Update Anomalies 1.3 Null Values in Tuplesss 1.4 Generation of Spurious Tuples 2 Functional Dependencies (FDs) 2.1 Definition of FD 2.2 Inference Rules for FDs 2.3 Equivalence of Sets of FDs 2.4 Minimal Sets of FDs 3 Normal Forms Based on Primary Keys 3.1 Introduction to Normalization 3.2 First Normal Form 3.3 Second Normal Form 3.4 Third Normal Form 4 General Normal Form Definitions (For Multiple Keys) 5 BCNF (Boyce-Codd Normal Form)

Informal Design Guidelines for Relational Databases What is relational database design? The grouping of attributes to form “good” relation schemas Two levels of relation schemas: –The logical “user view” level –The storage “base relation” level Design is concerned mainly with base relations What are the criteria for “good” base relations?

Informal Design Guidelines for Relational Databases (Cont.) We first discuss informally guidelines for good relational design Then we discuss formal concepts of functional dependencies and normal forms –1 NF (First Normal Form) –2 NF (Second Normal Form) –3 NF (Third Normal Form) –BCNF (Boyce-Codd Normal Form) Additional types of dependencies, further normal forms, relational design algorithms are discussed in Chapter 15

Semantics of the Relation Attributes Informally, each tuple should represent one entity or relationship instance Attributes of different entities (EMPLOYEEs, DEPARTMENTs, PROJECTs) should not be mixed in the same relation Only foreign keys should be used to refer to other entities (see 14-7) Figure 14.1 semantics of attributes reducing redundant values in tuples reducing null values in tuples disallowing spurious tuples Informal measures

Redundant Information in Tuples and Update Anomalies Mixing attributes of multiple entities may cause problems Information is stored redundantly (i.e., wasting storage (see 14-11)) Problems with update anomalies: –Insertion anomalies –Deletion anomalies –Modification anomalies

Figure 14.1 Simplified version of the COMPANY relational database schema

12-4a14-8 Figure 14.2 Example relations for the schema of Figure 14.1

12-4a14-9 Figure 14.2 Example relations for the schema of Figure 14.1 (Cont.)

GUIDELINE 1. Design a relation schema so that it is easy to explain its meaning. Do not combine attributes from multiple entity types and relationship types into a single relation EMPLOYEE * DEPARTMENT attributes from department attributes from project

Insertion Anomalies To insert a new employee tuple into EMP_DEPT, we must include either the attribute values for the department that employee works for or nulls. (if the employee does not work for a department)

Insertion Anomalies (Cont.) It is difficult to insert a new department that has no employees as yet in the EMP_DEPT relation Place null values?? SSN is a primary key the first employee is assigned

Deletion Anomalies If we delete from EMP_DEPT an employee tuple that happens to represent the last employee working for a particular department, the information concerning that department is lost.

Modification Anomalies In EMP_DEPT, if we change the value of one of attributes of a particular department, we must update the tuples of all employees who work in that department.

GUIDELINE 2. Design the base relation schemes so that no insertion deletion, or modification anomalies are present. Cost: join is needed (view definition)

Null Values in Tuples Relation should be designed such that their tuples will have few NULL values if possible. Attributes that are NULL frequently could be placed in separate relations (with the primary key) not applicable unknown known but absent Waste space join aggregate COUNT. SUM. AVG. problems Office numbers (~ 10%) EMP_OFFICES (ESSN, OFFICE_NUMBER)

Spurious Tuples Bad designs for a relational database may result in erroneous results for certain JOIN operations The “lossless join” property is used to guarantee meaningful results for join operations The relations should be designed to satisfy the lossless join condition Discussed in Chapter 15

=Π ENAME, PLOCATION (EMP_PROJ) see =Π SSN,PNUMBER,HOURS,PNAME,PLOCATION (EMP_PROJ)

EMP_PROJ1 * EMP_LOC

GUIDELINE 4. Design relation schemas so that they can be joined with equality conditions on attributes that either primary keys or foreign keys in a way that guarantees that no spurious tuples are generated.

Functional Dependencies Functional dependencies (FDs) are used to specify formal measures of the ‘goodness’ of relational designs FDs and keys are used to define normal forms for relations FDs are constrains that are derived from the meaning and interrelationships of the data attributes

Definition of FD A set of attributes X functionally determines a set of attributes if the value of X determines a unique value for Y Written as X→ Y; can be displayed graphically on a relation schema as in Figure 14.3 (see 14-11) Specifies a constraint on all relation instances r(R)

12-13/ Definition of FD (Cont.) If t 1 [X]= t 2 [X], then t 1 [Y]= t 2 [Y]For any two tuples t 1 and t 2 in any relation instance r(R): If t 1 [X]= t 2 [X], then t 1 [Y]= t 2 [Y] X is a candidate key of R ⇒ X→ Y for any subset Y of R X→ Y holds if whenever two tuples have the same value for X, they must have the same value for Y FDs are derived from the real-world constrains on the attributes

Examples of FD constraints: Social security number determines employee name SSN → ENAME Project number determines project name and location PNUMBER →{PNAME, PLOCATION}

Examples of FD constraints: (Cont.) Employee SSN and project number determines the hours per week that the employee works on the project {SSN, PNUMBER} → HOURS An FD is a property of the attributes in the schema R The constraint must hold on every relation instance r(R) t 1 [K]= t 2 [K])If K is a key of R, then K functionally determines all attributes in R (since we never have two distinct tuples with t 1 [K]= t 2 [K]) TEACH TEACHER Smith Smith Hall Brown COURSE D.S. D.M. Compilers D.S. TEXT Bartram Al-Nour Hoffman Augenthaler TEACHER → COURSE COURSE → TEXT TEXT → COURSE(P)

12-14a14-30 Inference Rules for Functional Dependencies Designer specifies the functional dependencies that are semantically obvious. closure of F ( Closure of F ) = { X → Y | F ㅑ X → Y} F ㅑ X → Y : X → Y is inferred from F F ㅑ X → Y : X → Y is inferred from F whenever r ( an extension of R ) whenever r ( an extension of R ) satisfies all the dependencies in F, X → Y also holds in r. satisfies all the dependencies in F, X → Y also holds in r. F = { SSN →{ENAME, BDATE, ADDRESS, DNUMBER}, F = { SSN →{ENAME, BDATE, ADDRESS, DNUMBER}, DNUMBER →{DNAME, DMGRSSN}} DNUMBER →{DNAME, DMGRSSN}} ㅑ SSN → { DNAME, DMGRSSN} ㅑ SSN → { DNAME, DMGRSSN} SSN → SSN SSN → SSN DNUMBER → DNAME DNUMBER → DNAME

Inference Rules for FDs Given a set of FDs F, we can infer additional FDs that hold whenever the FDs in F hold

Armstrong’s inference rules: notations {X,Y}→Z ≡ XY→ Z,{X,Y,Z}→{U,V} ≡ XYZ → UV A1. (Reflexive) If Y ⊆ X, then X →Y (trivial dependency) A2. (Augmentation) If X →Y, then XZ →YZ (Notation: XZ stands for X ∪ Z) A3. (Transitive) If X →Y and Y →Z, then X →Z A1,A2,A3 form a sound and complete set of inference rulesA1,A2,A3 form a sound and complete set of inference rules

Some additional inference rules that are useful: (Decomposition) If X →YZ, then X →Y and X→Z (Union) If X →Y and X →Z, then X →YZ (Psuedotransitivity) If X →Y and WY→Z, then WX →Z The last three inference rules, as well as any other inference rule can be deduced from A1, A2, and A3 (completeness property)

If Y ⊆ X, then X →Y A1. (Reflexive) If Y ⊆ X, then X →Y Proof. Assume t1, t2 ∈ r of R and t1[X] = t2[X] ∵ Y ⊆ X ∴ t1[Y] = t2[Y] t1[X] = t2[X]

A2. (Augmentation) If X →Y, then XZ →YZ Proof. Assume X→Y holds in a r of R. and XZ→YZ does not hold t1, t2 ∈ r 1)t1[X] =t2[X] 2)t1[Y] =t2[Y] 3)t1[XZ] = t2[XZ] 4)t1[YZ] ≠ t2[YZ] 5)t1[Z] = t2[Z] 6)t1[YZ] = t2[YZ] 7)XZ →YZ (X→Y) XZ→YZ (  ) 1) 3) 2) 5) 3) 6) contradiction

A3. (Transitive) If X →Y and Y →Z, then X →Z Proof. t1, t2 ∈ r of R and t1[X] = t2[X] 1)X →Y (given) 2)Y →Z (given) 3)t1[Y] = t2[Y] t1[X] = t2[X] & (1) 4)t1[Z] = t2[Z] (3) & (2) 5)X →Z t1[X] = t2[X] & (4)

Decomposition Rule {X →YZ} ㅑ X →Y 1)X →YZ (given) 2)YZ →Y (Reflexive rule) 3)X →Y (Transitive rule)

Union Rule {X →Y, X →Z} ㅑ X →YZ 1)X →Y (given) 2)X →Z (given) 3)X →XY augmenting on 1 with X 4)XY →YZ augmenting on 2 with Y 5)X →YZ transitive rule on (2) & (4)

Pseudotransitive Rule {X →Y, WY →Z} ㅑ WX →Z 1)X →Y (given) 2)WY →Z (given) 3)WX →WY (augmenting on 1with W) 4)WX →Z (transitive rule on (3) & (2))

Inference Rules for FDs (Cont.) F + = { X → Y | F ㅑ X → Y }Closure of a set F of FDs is the set F + of all FDs that can be inferred from F F + = { X → Y | F ㅑ X → Y } X + = { Y | F ㅑ X → Y }Closure of a set of attributes X with respect to F is the set X + of all attributes that are functionally determined by X X + = { Y | F ㅑ X → Y } X + can be calculated by repeatedly applying A1, A2, A3 using the FDs in F

Algorithm 12.1 Determining X + X + := X; repeat oldX + := X + ; for each functional dependency Y →Z in F do if Y ⊆ X + then X + ∪ Z until (oldX + = X + );

Example F = { SSN → ENAME, PNUMBER → {PNAME, PLOCATION}, {SSN, PNUMBER} → HOURS} {SSN} + = {SSN,ENAME} {PNUMBER} + = {PNUMBER, PNAME, PLOCATION} {SSN, PNUMBER} + = {SSN, PNUMBER, ENAME, PNAME, PLOCATION, HOURS} {SSN, PNUMBER} is a key

Equivalence of Sets of FDs Two sets of FDs F and G are equivalent if: –Every FD in F can be inferred from G, and –Every FD in G can be inferred from F Hence, F and G are equivalent if F + = G + Definition: F covers G if every FD in G can be inferred from F (i.e., if G + ⊆ F + )

Equivalence of Sets of FDs (Cont.) F and G are equivalent if F covers G and G covers F There is an algorithm for checking equivalence of sets of FDs F F covers E: ∀ X→Y ∈ E compute X + w.r.t. F check Y ∈ X + E E covers F: ∀ X→Y ∈ F compute X + w.r.t. E check Y ∈ X +

Minimal Sets of FDs A set of FDs is minimal if it satisfies the following conditions: 1)Every dependency in F has a single attribute for its RHS. 2)We cannot remove any dependency from F and have a set of dependencies that is equivalent to F 3)We cannot replace any dependency X →A in F with a dependency Y → A, where Y ⊂ X and still have a set of dependencies that is equivalent to F.

Minimal Sets of FDs (Cont.) Every set of FDs has an equivalent minimal set There can be several equivalent minimal sets Having a minimal set is important for some relational design algorithms (see Chapter 15)

12-21a14-47 Algorithm 14.2 Finding a minimal cover G for F 1.Set G : ﹦ F. 2.Replace each functional dependency X→{A 1,A 2,…,A n } in G by the n functional dependencies X →A 1, X →A 2,…, X → A n. 3.For each functional dependency X → A in G for each attribute B that is an element of X if (( G - {X → A}) ∪ {( X - {B}) →A} ) is equivalent to G, then replace X → A with ( X - {B}) → A in G. 4.For each remaining functional dependency X → A in G if (G - {X → A}) is equivalent to G, then remove X → A from G.

Normal Forms Based on Primary Keys 3 Normal Forms Based on Primary Keys 3.1 Introduction to Normalization Normalization: Process of decomposing unsatisfactory “bad” relations by breaking up their attributes into smaller relations Normal form: Condition using keys and FDs of a relation to certify whether a relation schema is in a particular normal form

Introduction to Normalization (Cont.) 2NF, 3NF, BCNF based on keys and FDs of a relation schema prime attribute : member of any key nonprime attribute 4NF based on keys, MVDs; 5NF based on keys, JDs (Chapter 15) Additional properties may be needed to ensure a good relational design (lossless join, dependency preservation; Chapter 15)

First Normal Form Disallows composite attributes, multivalued attributes, and nested relations: attributes whose values for an individual tuple are non-atomic Considered to be part of the definition of relation

Figure 14.8 (a) A relation schema that is not in 1NF (b) Example relation instance

Figure 14.8 (Cont.) (c) 1NF relation with redundancy alternative 1 SSN → PLOCATION KEY:{DNUMBER,DLOCATION} alternative 2 (better) SSN → DLOCATION

Figure 14.9 (a) A nested relation PROJS within EMP_PROJ Primary keyPartial key EMP_PROJ (SSN, ENAME, {PROJS (PNUMBER, HOURS)})

Figure 14.9 (b) Example extension of the EMP_PROJ relation showing nested relations within each tuple.

Figure 14.9 (c) Decomposing EMP_PROJ into 1NF relations by migrating the primary key

Second Normal Form Uses the concepts of FDs, primary key Definitions: Prime attribute – attribute that is member of the primary key K (candidate key??) Full functional dependency – a FD Y →Z where removal of any attribute from Y means the FD does not hold any more. ∀ A ∈ Y, ( Y - {A}) →Z ×

Example:  {SSN, PNUMBER} →HOURS is a full FD since neither SSN → HOURS nor PNUMBER → HOURS hold  {SSN, PNUMBER} →ENAME is not a full FD (it is called partial dependency) since SSN →ENAME also holds 3.3 Second Normal Form (Cont.) ∃ A ∈ Y, ( Y - {A}) → Z (i.e., A=PNUMBER)

A relation schema R is in second normal form (2NF) if every non-prime attribute A in R is fully functionally dependent on the primary key prime attribute K→A trivial dependency R can be decomposed into 2NF relations via the process of 2NF normalization 3.3 Second Normal Form (Cont.)

Figure fd2 and fd3 violate 2NF, i.e., ENAME, PNAME, and PLOCATION partially dependent on {SSN, PNUMBER} ㅑ SSN→DNUMBER DNUMBER →DMGRSSN ㅑ SSN →DMGRSSN 2NF (O) 3NF (X) It is not a primary key

12-26a14-60 Y→X (non-trivial dependency) ≡ ∀ t1, t2 ∈ r, if t1[Y] = t2[Y] then t1[X] = t2[X] 有可能 t1[Y] ≠ t2[Y], 但是 t1[X] = t2[X] X →Z (non-trivial dependency) 只要上述可能性發生, 資料就重複

12-26a14-61 SSN ( 或 PNUMBER) 僅是 key 的一部份,而非 key , 表示可能有一個以上的 tuples 具有相同的值,再加上 SSN→ENAME PNUMBER→PNAME PLOCATION 相依部分也會重複

Third Normal Form Definition: Transitive functional dependency- a FD Y→Z that can be derived from two FDs Y→X and X →Z nontrivial dependency X is not a subset of any key

Examples:  SSN→DMGRSSN is a transitive FD since SSN→DNUMBER and DNUMBER→DMGRSSN hold  SSN→ENAME is non-transitive since there is no set of attributes X where SSN→X and X→ENAME 3.4 Third Normal Form (Cont.)

Third Normal Form (Cont.) A relation schema R is in third normal form (3NF) if it is in 2NF and no non-prime attribute A in R is transitively dependent on the primary key (see 14-59/60/61 ) Figure R can be decomposed into 3NF relations via the process of 3NF normalization

General Normal Form Definitions (For Multiple Keys) The above definitions consider the primary key only The following more general definitions take into account relations with multiple candidate keys A relation schema R is in second normal form (2NF) if every non-prime attribute A in R is fully functionally dependent on every key of R (see Figure 14.11)

Figure 14.11(a) Parcels of lands for sale in various counties of a state Candidate keys: PROPERTY_ID# {COUNTY_NAME, LOT#} Partial dependency

Figure (b) transitive dependency

Definition: Superkey of relation schema R- a set of attributes S of R that contains a key of R A relation schema R is in third normal form (3NF) if whenever a FD X →A holds in R, then either: (a) X is a superkey of R, or (b) A is a prime attribute of R (see 14-67/68/69)Figure Boyce-Codd normal form disallows condition (b) above A: nonprime transitive dependency key Y Y →X Y →A X →A X: proper subset of a key key Y Y →X Y →A X →A partial dependency

Figure (c) (d) fd5 Marion 0.5 County Liberty 1.1 County 1.2 :

BCNF (Boyce-Codd Normal Form) A relation schema R is in Boyce-Codd Normal Form (BCNF) if whenever a FD X →A holds in R, then X is a superkey of R (14-71a) Figure 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 (14-71b) Figure 14.12

Figure (a) BCNF normalization with the dependency of FD2 being ‘lost’ in the decomposition (b) A relation R in 3NF but not in BCNF Non-prime: C prime: A. B

Three possible decompositions: 1.{STUDENT, INSTRUCTOR} and { STUDENT, COURSE} 2.{COUSE, INSTRUCTOR} and { COURSE, STUDENT} 3.{INSTRUCTOR, COURSE} and { INSTRUCTOR, STUDENT} generate spurious tuples lossless join “lost” FD1 FD1 FD2 3NF, but not BCNF

STUDENTINSTRUCTORCOURSESTUDENT

INSTRUCTORCOURSESTUDENTINSTRUCTOR

BCNF (Boyce-Codd Normal Form) Cont. The goal is to have each relation in BCNF (or 3NF) Additional criteria may be needed to ensure the set of relations in a relational database are satisfactory (see Chapter 15) –Lossless join property –Dependency preservation property Additional normal forms are discussed in Ch. 15 –4NF (based on multi-valued dependencies) –5NF (based on join dependencies)