Functional Dependencies Prof. Yin-Fu Huang CSIE, NYUST Chapter 11.

Slides:



Advertisements
Similar presentations
Functional dependencies 1. 2 Outline motivation: update anomalies cause: not expressed constraints on data (FDs) functional dependencies (FDs) definitions.
Advertisements

1 Term 2, 2004, Lecture 2, Normalisation - IntroductionMarian Ursu, Department of Computing, Goldsmiths College Normalisation Introduction.
Dr. Alexandra I. Cristea CS 319: Theory of Databases.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
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.
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)
Properties of Armstrong’s Axioms Soundness All dependencies generated by the Axioms are correct Completeness Repeatedly applying these rules can generate.
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Lecture #16: Schema Refinement & Normalization - Functional Dependencies.
C.1 Appendix C: Advanced Relational Database Design Reasoning with MVDs Higher normal forms Join dependencies and PJNF DKNF.
Topics to be discusses Functional Dependency Key
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 227 Database Systems I Design Theory for Relational Databases.
Multivalued Dependency Prepared by Tomasz Kaciak CS157A.
FDImplication: 1 Functional Dependencies (FDs) Let r(R) be a relation and let t  r, then the restriction of t to X  R, written t[X], is the projection.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
CMSC424: Database Design Instructor: Amol Deshpande
DATABASE DESIGN Functional Dependencies. Overview n Functional Dependencies n Normalization –Functional dependencies –Normal forms.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Dr. Alexandra I. Cristea CS 319: Theory of Databases: C3.
Normalization. FarkasCSCE 5202 Reading Assignments  Database Systems The Complete Book: Chapters 3.6, 3.7, 3.8  Following lecture slides are modified.
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.
Chapter 5 Integrity Constraints 5.1 Domain ConstraintsDomain Constraints 5.2 Referential IntegrityReferential Integrity 5.3 AssertionsAssertions 5.4 TriggersTriggers.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
FUNCTIONAL DEPENDENCIES
Computing & Information Sciences Kansas State University Monday, 13 Oct 2008CIS 560: Database System Concepts Lecture 18 of 42 Monday, 13 October 2008.
Introduction to Normalization CPSC 356 Database Ellen Walker Hiram College.
Normal Forms1. 2 The Problems of Redundancy Redundancy is at the root of several problems associated with relational schemas: Wastes storage Causes problems.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Further Normalization II: Higher Normal Forms Prof. Yin-Fu Huang CSIE, NYUST Chapter 13.
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.
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.
BCNF & Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
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.
CS 564 Database Management Systems: Design and Implementation Discussion Session Friday, Sept 18, Apul Jain.
Logical Database Design (1 of 3) John Ortiz Lecture 6Logical Database Design (1)2 Introduction  The logical design is a process of refining DB schema.
1 Lecture 6: Schema refinement: Functional dependencies
Revisit FDs & BCNF Normalization 1 Instructor: Mohamed Eltabakh
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
1 Dept. of CIS, Temple Univ. CIS616/661 – Principles of Data Management V. Megalooikonomou Integrity Constraints (based on slides by C. Faloutsos at CMU)
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
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.
1 Functional Dependencies. 2 Motivation v E/R  Relational translation problems : –Often discover more “detailed” constraints after translation (upcoming.
Lecture No 13 Functional Dependencies & Normalization ( II ) Mar 3 rd 2011 Database Systems.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Functional Dependencies CIS 4301 Lecture Notes Lecture 8 - 2/7/2006.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
MIS 3053 Database Design And Applications The University Of Tulsa Professor: Akhilesh Bajaj Normal Forms Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003.
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.
Databases 1 Sixth lecture. 2 Functional Dependencies X -> A is an assertion about a relation R that whenever two tuples of R agree on all the attributes.
© 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.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Advanced Database System
Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Advanced Normalization
Advanced Normalization
Functional Dependencies
Chapter 19 (part 1) Functional Dependencies
Relational Database Design
CSC 453 Database Systems Lecture
Presentation transcript:

Functional Dependencies Prof. Yin-Fu Huang CSIE, NYUST Chapter 11

Advanced Database SystemYin-Fu Huang 11.1Introduction A functional dependency (FD) is basically a many-to- one relationship from one set of attributes to another within a given relvar.

Advanced Database SystemYin-Fu Huang 11.2Basic Definitions To distinguish between (a) the value of a given relvar at a given point in time and (b) the set of all possible values that the given relvar might assume at different times Case (a):  Let r be a relation, and let X and Y be arbitrary subsets of the set of attributes of r. Y is functionally dependent on X, X →Y, if and only if each X value in r has associated with it precisely one Y value in r.  Sample value (See Fig. 11.1) {S#}→{City} {S#,P#}→{S#,P#,City,Qty} {S#}→{Qty} {Qty}→{S#}

Advanced Database SystemYin-Fu Huang 11.2Basic Definitions (Cont.) Case (b):  Let R be a relation variable, and let X and Y be arbitrary subsets of the set of attributes of R. Y is functionally dependent on X, X →Y, if and only if in every possible legal value of R, each X value has associated with it precisely one Y value. {S#}→{Qty} and {Qty}→{S#} do not hold “for all time” If relvar R satisfies the FD A →B and A is not a candidate key, then R will necessarily involve some redundancy. To find some way of reducing the set of FDs to a manageable size. The reason is that FDs represent certain integrity constraints, and we would thus like the DBMS to enforce them.

Advanced Database SystemYin-Fu Huang 11.3Trivial and Nontrivial Dependencies An FD is trivial if and only if the right-hand side is a subset of the left-hand side. {S#,P#}→{S#} The trivial dependencies can be eliminated.

Advanced Database SystemYin-Fu Huang 11.4Closure of a Set of Dependencies The set of all FDs that are implied by a given set S of FDs is called the closure of S, written S +. Armstrong‘s axioms: 1. Reflexivity: If B is a subset of A, A →B. 2. Augmentation: If A →B, then AC →BC. 3. Transitivity: If A →B and B →C, then A →C. The rules are complete and sound. 4. Self-determination: A →A. 5. Decomposition: If A →BC, then A →B and A →C. 6. Union: If A →B and A →C, then A →BC. 7. Composition: If A →B and C →D, then AC →BD. 8. General Unification Theorem: If A →B and C →D, then A ∪ (C-B)→BD.

Advanced Database SystemYin-Fu Huang 11.4Closure of a Set of Dependencies (Cont.) Example: R:{A,B,C,D,E,F} and the FDs A →BC B →E CD →EF AD →F is a member of the closure of the given set. 1. A →BC (given) 2. A →C (1, decomposition) 3. AD →CD (2, augmentation) 4. CD →EF (given) 5. AD →EF (3 and 4, transitivity) 6. AD →F (5, decomposition)

Advanced Database SystemYin-Fu Huang 11.5Closure of a Set of Attributes Given a relvar R, a set Z of attributes of R, and a set S of FDs that hold for R, we can determine the set of attributes of R that are functionally dependent on Z-the closure Z + of Z under S. A simple algorithm for computing the closure Z + (See Fig. 11.2)

Advanced Database SystemYin-Fu Huang 11.5Closure of a Set of Attributes (Cont.) Example: R:{A,B,C,D,E,F} and the FDs A →BC E →CF B →E CD →EF Computing the closure {A,B} + ={A,B,C,E,F} Given a set S of FDs, we can easily tell whether a specific FD X →Y follows from S, because that FD will follow if and only if Y is a subset of the closure X + of X under S. A superkey for a relvar R is a set of attributes of R that includes some candidate key of R as a subset. K is a superkey if and only if the closure K + of K under the given set of FDs is precisely the set of all attributes of R. K is a candidate key if and only if it is an irreducible superkey.

Advanced Database SystemYin-Fu Huang 11.6Irreducible Sets of Dependencies (1/3) If every FD implied by S1 is implied by S2, S2 is a cover for S1. Equivalence A set S of FDs to be irreducible if and only if it satisfies the following three properties: 1. The right side of every FD in S involves just one attribute. 2. The left side of every FD in S is irreducible, meaning that no attribute can be discarded from the determinant without changing the closure S No FD in S can be discarded from S without changing the closure S +.

Advanced Database SystemYin-Fu Huang 11.6Irreducible Sets of Dependencies (2/3) Example: 1. P#→{Pname,Color} P#→Weight P#→City 2. {P#,Pname}→Color P#→Pname P#→Weight P#→City 3. P#→P# P#→Pname P#→Color P#→Weight P#→City

Advanced Database SystemYin-Fu Huang 11.6Irreducible Sets of Dependencies (3/3) For every set of FDs, there exists at least one equivalent set that is irreducible. Example: R:{A,B,C,D} and the FDs A →BC B →C A →B A →B  B →C AB →C A →D AC →D A given set of FDs does not necessarily have a unique irreducible equivalent.

Advanced Database SystemYin-Fu Huang The End.