Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)

Slides:



Advertisements
Similar presentations
primary key constraint foreign key constraint
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
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.
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.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Further Dependencies by Pinar Senkul resources: mostly froom Elmasri, Navathe and other books.
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.
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.
Functional Dependencies - Example
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.
DATABASE DESIGN Functional Dependencies. Overview n Functional Dependencies n Normalization –Functional dependencies –Normal forms.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
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.
Databases 6: Normalization
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.
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.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
DatabaseIM ISU1 Chapter 10 Functional Dependencies and Normalization for RDBs Fundamentals of Database Systems.
SCUJ. Holliday - coen 1784–1 Schedule Today: u Normal Forms. u Section 3.6. Next u Relational Algebra. Read chapter 5 to page 199 After that u SQL Queries.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 11 Relational Database Design Algorithms and Further Dependencies.
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.
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
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications C. Faloutsos – A. Pavlo Lecture#16: Schema Refinement & 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
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
Deanship of Distance Learning Avicenna Center for E-Learning 1 Session - 7 Sequence - 2 Normalization Functional Dependencies Presented by: Dr. Samir Tartir.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
Chapter 7 Functional Dependencies Copyright © 2004 Pearson Education, Inc.
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.
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.
Relational Database Design Algorithms and Further Dependencies.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
11/06/97J-1 Principles of Relational Design Chapter 12.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.
Functional Dependencies and Normalization for Relational Databases 1 Chapter 15 تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في.
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Functional Dependency and Normalization
Advanced Normalization
Chapter 15 Relational Design Algorithms and Further Dependencies
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Advanced Normalization
Functional Dependencies
Relational Database Theory
CSC 453 Database Systems Lecture
Presentation transcript:

Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)

Database Management COP4540, SCS, FIU What are functional dependencies A FD is a constraint between two sets of attributes from the database.. A FD, denoted by X Y, between two sets of attributes X and Y forms a constraint that states: –For any two tuples t 1 and t 2 such that t 1 [X] =t 2 [X], we much also have t 1 [Y] =t 2 [Y]. –The values of the Y component of a tuple depend on, or are determined by, the values of X component.

Database Management COP4540, SCS, FIU Example Employee(SSN, EName) Project(ProjectNo, ProjectName, DeptName) WorksOn(SSN, ProjectNo, Hours) Functional dependencies: SSN Ename ProjectNo ProjectName DeptName SSN ProjectNo Hour

Database Management COP4540, SCS, FIU Additional Notes A functional dependency is a property of the semantics or meaning of the attributes. A functional dependency is a property of the relation schema R, not of a particular legal relation state r of R. –FD cannot be inferred from a given relation state. –It must be defined explicitly by someone who knows the semantics of the attributes of R.

Database Management COP4540, SCS, FIU Keys and FDs A key is a determinant, while a determinant may or may not be a key. A key is always unique to the relation, while a determinant may or may not be unique to the relation. The most significant difference between keys and FDs is UNIQUENESS and MINIMALITY. Several terms: –Superkey –Candidate Key –Primary Key

Database Management COP4540, SCS, FIU Example Student(SSN, Name, Phone, City, Street, Zip) SSN Phone Name City Street Zip SSN Name City Street Zip City Street Zip

Database Management COP4540, SCS, FIU Example EMP_DEPT EMP_PROJ

Database Management COP4540, SCS, FIU Computing the Closure of Attributes What is the closure of attributes? –Given a set of attributes A = {A 1, A 2, …, A n } and a set of FDs S, the closure of A under the FDs in S is the set of attributes B such that every relation that satisfies all the FDs in S also satisfies A 1, A 2, …, A n B. –B is denoted by A + = {A 1, A 2, …, A n } + How to compute a closure? Algorithm: Determining X +, the closure of X under F X + = X; repeat oldX + = X + ; for each FD Y Z in F do if Y  X + then X + = X +  Z; until ( oldX + = X + );

Database Management COP4540, SCS, FIU Let us consider a relation with attribute A, B, C, D, E and F. Suppose that this relation has the functional dependencies AB C, BC AD. D E, and CF B. 1. What is the closure of {A, B}, that is {A,B} + ? 2. How to test whether AB D follows from these dependencies? How about D A? 3. What can be the primary key of this relation? Example

Database Management COP4540, SCS, FIU Splitting/Combing Rule Splitting rule A FD A 1 A 2 … A n B 1 B 2 … B m can be replaced by a set of FDs A 1 A 2 … A n B i for i = 1, 2, …, m. Combining rule A set of FDs A 1 A 2 … A n B i for i = 1, 2, …, m can be replaced by a single FD A 1 A 2 … A n B 1 B 2 … B m

Database Management COP4540, SCS, FIU Trivial-dependency Rule A FD A 1 A 2 … A n B 1 B 2 … B m is –Trivial if the B’s are a subset of the A’s. –Nontrivial if at least one of the B’s is not among the A’s. –Completely nontrivial if none of the B’s is also one of the A’s. Trivial-dependency rule The FD A 1 A 2 … A n B 1 B 2 … B m is equivalent to A 1 A 2 … A n C 1 C 2 … C k, where the C’s are all those B’s that are not also A’s

Database Management COP4540, SCS, FIU The Transition Rule If two FDs A 1, A 2, …, A n B 1, B 2, …, B m and B 1, B 2, …, B m C 1, C 2, …, C k hold in relation R, then A 1, A 2, …, A n C 1, C 2, …, C k also holds in R. This rule can be proved by computing the closure of {A 1, A 2, …, A n } under {A 1, A 2, …, A n B 1, B 2, …, B m B 1, B 2, …, B m C 1, C 2, …, C k }.

Database Management COP4540, SCS, FIU A complete Set of Inference Rules Armstrong’s axioms (1974) –Reflexivity if X  Y then X Y –Augmentation {X Y} XZ YZ –Transitivity {X Y, Y Z} X Z

Database Management COP4540, SCS, FIU Other rules Decomposition ( or projective) rule – { X YZ} X Y Union ( or additive) rule –{X Y, X Z} X YZ Pseudotransitive rule –{X Y, WY Z} WX Z

Database Management COP4540, SCS, FIU Proof 1. X--->YZ (given) YZ ---> Y ( using Reflexivity) X ---> Y ( applying transitivity to the above two FDs) 2. X ---> Y (given) X----> Z (given) X ----> XY (applying augmentation to rule 1) XY --> YZ (applying augmentation to rule 2) X ---> YZ ( applying transitivity to the above two rules) 3. X ---> Y (given) WY ---> Z (given) WX ---> WY ( using augmentation to rule 1) WX ---> Z (applying transitivity to rule 2 and 3)

Database Management COP4540, SCS, FIU Equivalence of Sets Dependencies Given two sets of dependencies E and F, the closures of these two sets are E + and F + respectively, We say –E is covered by F, if E  F +. –E and F are equivalent if E + = F +. –How to determine the equivalence? calculating X + under F for each FD X Y in E, and then checking whether this X + includes the attributes in Y. (This is to determine whether E is covered by F) determining whether F is covered by E by the same approach above.

Database Management COP4540, SCS, FIU Example E = {A B, B A, B C, C A} F = {A B, B C, C A }

Database Management COP4540, SCS, FIU Minimal Sets of FDs A set of FDs F is minimal if it satisfies the following condition: –Every FD in F has a single attribute for its right-hand side. –We cannot replace any FD X A with a FD 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 FDs that is equivalent to F. A minimal basis of F is denoted by F min, and there may be several minimal bases for one particular F.