Properties of Armstrong’s Axioms Soundness All dependencies generated by the Axioms are correct Completeness Repeatedly applying these rules can generate.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Advertisements

Announcements Read 6.1 – 6.3 for Wednesday Project Step 3, due now Homework 5, due Friday 10/22 Project Step 4, due Monday Research paper –List of sources.
CS 440 Database Management Systems Practice problems for normalization.
Manipulating Functional Dependencies Zaki Malik September 30, 2008.
Chapter 11 Functional Dependencies. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.11-2 Topics in this Chapter Basic Definitions Trivial.
1 Design Theory. 2 Minimal Sets of Dependancies A set of dependencies is minimal if: 1.Every right side is a single attribute 2.For no X  A in F and.
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.
Temple University – CIS Dept. CIS616– Principles of Data Management V. Megalooikonomou Functional Dependencies (based on notes by Silberchatz,Korth, and.
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Lecture #16: Schema Refinement & Normalization - Functional Dependencies.
CS Algorithm : Decomposition into 3NF  Obviously, the algorithm for lossless join decomp into BCNF can be used to obtain a lossless join decomp.
Multivalued Dependency Prepared by Tomasz Kaciak CS157A.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
1 Normalization Chapter What it’s all about Given a relation, R, and a set of functional dependencies, F, on R. Assume that R is not in a desirable.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Cs3431 Normalization. cs3431 Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Functional Dependencies CS 186, Spring 2006, Lecture 21 R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another.
1 Database Theory and Methodology. 2 The Good and the Bad So far we have not developed any measure of “goodness” to measure the quality of the design,
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Functional Dependencies Prof. Yin-Fu Huang CSIE, NYUST Chapter 11.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
FUNCTIONAL DEPENDENCIES. Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information.
Normal Forms1. 2 The Problems of Redundancy Redundancy is at the root of several problems associated with relational schemas: Wastes storage Causes problems.
CSCD34 - Data Management Systems - A. Vaisman1 Schema Refinement and Normal Forms.
DAVID DENG CS157B MARCH 23, 2010 Dependency Preserving Decomposition.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Schema Refinement and Normal Forms Chapter 19 1 Database Management Systems 3ed, R.Ramakrishnan & J.Gehrke.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
Functional Dependencies An example: loan-info= Observe: tuples with the same value for lno will always have the same value for amt We write: lno  amt.
THIRD NORMAL FORM (3NF) A relation R is in BCNF if whenever a FD XA holds in R, one of the following statements is true: XA is a trivial FD, or X is.
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 Lecture 6: Schema refinement: Functional dependencies
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
Christoph F. Eick: Functional Dependencies, BCNF, and Normalization 1 Functional Dependencies, BCNF and Normalization.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Minimum Cover of F. Minimal Cover for a Set of FDs Minimal cover G for a set of FDs F: –Closure of F = closure of G. –Right hand side of each FD in G.
Deanship of Distance Learning Avicenna Center for E-Learning 1 Session - 7 Sequence - 2 Normalization Functional Dependencies Presented by: Dr. Samir Tartir.
1 Functional Dependencies. 2 Motivation v E/R  Relational translation problems : –Often discover more “detailed” constraints after translation (upcoming.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 15.
Functional Dependencies R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another. Thomas Hobbes ( )
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Lecture #16: Schema Refinement & Normalization - Functional Dependencies.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Functional Dependencies CIS 4301 Lecture Notes Lecture 8 - 2/7/2006.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CS 222 Database Management System Spring Lecture 4 Database Design Theory Korra Sathya Babu Department of Computer Science NIT Rourkela.
CS542 1 Schema Refinement Chapter 19 (part 1) Functional Dependencies.
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
© 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 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Advanced Normalization
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Advanced Normalization
Schema Refinement & Normalization Theory
Normalization cs3431.
Some slides are from Dr. Sara Cohen
Chapter 19 (part 1) Functional Dependencies
Presentation transcript:

Properties of Armstrong’s Axioms Soundness All dependencies generated by the Axioms are correct Completeness Repeatedly applying these rules can generate all correct dependency (i.e., any FDs in F + be generated)

Closure of Attribute Set X Let F be a set of functional dependencies on a set of attributes U and let X U. We define X + to be the set of all attributes that are dependent on X (under F). X + enables us to tell at a glance whether a dependency X  A follows from F.

Algorithm to compute X + under F // initialization 1.X + := X; // reflexive rule // find new attribute 2.For each function dependency Y  Z in F, if Y X + and Z has an attribute not in X +, add the new attribute to X+; //transitive rule 3.Repeat Step 2 until no new attribute can be found R(A,B,C,D,E,F), F={A->D, B->E, D  B, C->F}, What is {A} +? Example 1

Closure of Attribute Set: Example 2 EMP_PROJ(SSN,PNUMBER,HOURS,ENAME,PNAME,PLOCATION) F={ { SSN}->{ENAME}, { PNUMBER}->{PNAME,PLOCATION}, {SSN,PNUMBER}  {HOURS} } Initialization:{SSN} + ={SSN} 1 st iteration: SSN->ENAME, ENAME to is a new attribute {SSN} + ={SSN,ENAME} 2 nd iteration: {SSN} + ={SSN,ENAME}, cannot find any new attribute (1) Compute {SSN} +

(2) Compute {PNUMBER} + Initialization:{PNUMBER} + ={PNUMBER} 1 st iteration: {PNUMBER} -> {PNAME,PLOCATION} {PNUMBER} + ={PNUMBER,PNAME,PLOCATION} 2 nd iteration: cannot find any new attribute {PNUMBER} + ={PNUMBER,PNAME,PLOCATION} (3) Compute {SSN, PNUMBER} + F={ {SSN}->{ENAME}, {PNUMBER}->{PNAME,PLOCATION}, {SSN,PNUMBER}  {HOURS} }

Steps of checking if an FD X  Y is in the closure of a set of FDs F : 1.Compute X + wrt F. 2.Check if Y is in X +. 3.Y X + X  Y is in F + Does F = {A  B, B  C, CD  E } imply A  E? i.e, is A  E in F + ? Equivalently, is E in A + ? A + (w.r.t. F)={A,B,C} E is not in A +, thus, A  E is not in F +. Use of X + 1: Checking if X  Y

Set K:=R For each attribute A in K Compute (K-A) + w.r.t. F If (K-A) + contains all the attributes in R then set K:= K-A This algorithm returns only one key out of the possible candidate keys for R. The key returned depends on the order in which attributes are removed from R. Examples: (1) R={A,B,C,D} F={A  B,B  C,AB  D}; find a key of R. (2) R={A,B,C,D,E,F} F= {A->C, A->D, B->C, E->F}; find a key of R Use of X + 2: Finding a key K Let R be the set of attributes for a schema and F be its functional dependency set

Given a set of functional dependencies F, we define F + to be the set of all functional dependencies that can be inferred from F. Use of X + 3: Compute F + 1.F + ={}; 2.For each attribute set A in R, computing A + 3.For each X  Y implied by A +, add X  Y to F+

Equivalence of Sets of Functional Dependencies Let E&F be two sets of functional dependencies. F covers E if E F +. E and F are equivalent if E + =F +. E + =F + iff E covers F and F covers E. Note: Equivalence means that every FD in E can be inferred from F, and every FD in F can be inferred from E. Determine whether F covers E: For each FD X  Y in E, calculate X + with respect to F, then check whether X + Y.

EXAMPLE: Check whether or not F is equivalent to G. F={A  C, AC  D, E  AD,E  H} G={A  CD, E  AH} Prove that F is covered by G. {A} + ={A,C,D} (wrt to G). Since {C} A +, A  C can be inferred from G. {AC} + ={A,C,D} (wrt to G). Since {D} {AC} +, AC  D is covered by G. {E} + ={E,A,H,C,D} (wrt G), Since {AD} {E} +, E  AD is covered by G. Since {H} {E} +, E  H is covered by G.

Prove that G is covered by F: {A} + ={A,C,D} (wrt F), Since {CD} {A} +, A  CD is covered by F. {E} + ={E,A,D,H,C} (with respect to F) {A,H} {E} +, E  AH is covered by F. Since F covers G and G covers F, F and G are equivalent. F={A  C, AC  D, E  AD,E  H} G={A  CD, E  AH}

Minimal Cover of Functional Dependencies A set of functional dependencies F is minimal if it satisfies the following three conditions: Every FD in F has a single attribute for its right-hand side. (This is a standard form, not a requirement.) We cannot replace any dependency X  A in F with a dependency Y  A, where Y is a proper subset of X, and still have a set of dependencies that is equivalent to F. We cannot remove any dependency from F and still have a set of dependencies that is equivalent to F. There can be several minimal covers for a set of functional dependencies!

Minimal Cover Definition: A minimal cover of a set of FDs F is a minimal set of functional dependencies F min that is equivalent to F. /* The following procedure finds one minimal cover of F. */ Procedure: Find a minimal cover F min for F. 1.Set F min =F /*put every FD in a standard form, i.e., it has a single attribute as its right-hand side*/ 2.Replace each FD X  A 1,A 2,…,A n in F min by the n FDs X  A 1,…,X  A n. /* minimize the left side of each FD, i.e., every attribute is needed */ 3.For each FD X  A in F min For each B X, Let T=(F min - {X  A})U{(X-{B})  A} Check whether T is equivalent to F min (1) If (1) is true, then set F min = T. /* delete redundant FDs, i.e., No redundant FDs remain in Fmin. */ 4.For each FD X  A in F min Let T=F min -{X  A} Check whether T is equivalent to F min. (2) If (2) is true, set F min = T.

Minimal Cover F={X1  Y1, X2  Y2, … Xn  Yn} is a minimum cover 1)Any Yi is a single attribute 2)For any Xi  Yi, it is impossible that X’  Y and X’ is a subset of X 3)No Xi  Yi can be taken out F’ = F - {Xi  Yi} is not equivalent to F

Example: Find the minimal cover of the set F={ABCD  E,E  D,A  B,AC  D}.

Example: Find the minimal cover of the set F={ABCD  E,E  D,A  B,AC  D}. Step 2:F min ={ABCD  E,E  D,A  B,AC  D} Step 3: Replace AC  D with A  D; T={ABCD  E,E  D,A  B,A  D} Compute {A} + wrt to F, {A} + ={A,B} Compute {A} + wrt to T, {A} + ={A,B,D} Cannot replace F min with T. Replace ABCD  E with ACD  E, T={ACD  E,E  D,A  B,AC  D} Compute {ACD} + wrt to F, {ACD} + ={A,C,D,B,E} Compute {ACD} + wrt to T,{ACD} + ={A,C,D,E,B} Replace F min with T. Is T equivalent to F min ? Can Fmin Cover T? No, keep AC  D

Step 3: (cont’d) Replace ACD  E with AC  E, T={AC  E,E  D,A  B,AC  D} Compute {AC} + wrt to F, {AC} + ={ACDBE} Compute {AC} + wrt to T,{AC} + ={ACEDB} Replace F min with T. Step 4: Consider T={AC  E,E  D,AC  D,A  B} (take out AC  D) {AC} + ={A,C,E,D,B} with respect to T; {D} {AC} + ; we don’t have to include AC  D The minimal cover of F is: {AC  E,E  D,A  B}

Some Important Concepts X + : Closure of an attribute set X –The set of all attributes that are determined by X K: a key –minimum set of attributes that determines all attributes F + : Closure of a dependency set F –The set of all dependencies that are implied from F F min : a minimum cover of a dependency set F –a minimum set of FDs that is equivalent to F