Functional Dependencies

Functional Dependencies

<p></p><ul style="display: flex;"><li style="flex:1">Basics of FDs </li><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Functional Dependencies </p><p>T. M. Murali <br>October 19, 21 2009 </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example </p><p></p><ul style="display: flex;"><li style="flex:1">Name </li><li style="flex:1">Id </li></ul><p>Name <br>Id </p><p></p><ul style="display: flex;"><li style="flex:1">Advises </li><li style="flex:1">Advisors </li></ul><p>Students </p><p>Favourite </p><p>I</p><p>Convert to relations: </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example </p><p></p><ul style="display: flex;"><li style="flex:1">Name </li><li style="flex:1">Id </li></ul><p>Name <br>Id </p><p></p><ul style="display: flex;"><li style="flex:1">Advises </li><li style="flex:1">Advisors </li></ul><p>Students </p><p>Favourite </p><p>I</p><p>Convert to relations: </p><p>Students(Id, Name) Advisors(Id, Name) Advises(StudentId, AdvisorId) Favourite(StudentId, AdvisorId) </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example </p><p></p><ul style="display: flex;"><li style="flex:1">Name </li><li style="flex:1">Id </li></ul><p>Name <br>Id </p><p></p><ul style="display: flex;"><li style="flex:1">Advises </li><li style="flex:1">Advisors </li></ul><p>Students </p><p>Favourite </p><p>II</p><p>Convert to relations: </p><p>Students(Id, Name) Advisors(Id, Name) Advises(StudentId, AdvisorId) Favourite(StudentId, AdvisorId) </p><p>Suppose we perversely decide to convert Students, Advises, and Favourite into one relation. </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>I</p><p>If you know a student’s Id, can you determine the values of any other attributes? </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>I</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>I</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>I</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>I</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → AdvisorName </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>II</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → AdvisorName </p><p>Can we say Id → AdvisorId? </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>II</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → AdvisorName </p><p>Can we say Id → AdvisorId? NO! Id is not a key for the Students relation. </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>I</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → AdvisorName </p><p>II</p><p>Can we say Id → AdvisorId? NO! Id is not a key for the Students relation. What is the key for the Students? </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>I</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → AdvisorName </p><p>II</p><p>Can we say Id → AdvisorId? NO! Id is not a key for the Students relation. What is the key for the Students? {Id, AdvisorId}. </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>II</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → AdvisorName </p><p>Can we say Id → AdvisorId? NO! Id is not a key for the Students relation. </p><p>II</p><p>What is the key for the Students? {Id, AdvisorId}. Why is this relation“bad?” </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Example of a Bad Relation </p><p>Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId) </p><p>II</p><p>If you know a student’s Id, can you determine the values of any other </p><p>attributes? Name and FavouriteAdvisorId. </p><p>Id → Name Id → FavouriteAdvisorId AdvisorId → AdvisorName </p><p>Can we say Id → AdvisorId? NO! Id is not a key for the Students relation. </p><p>II</p><p>What is the key for the Students? {Id, AdvisorId}. Why is this relation“bad?” Parts of the key determine other attributes. </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Motivation for Functional Dependencies </p><p>IIII</p><p>Reason about constraints on attributes in a relation. Procedurally determine the keys of a relation. Detect when a relation has redundant information. Improve database designs systematically using normalisation. </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Definition of Functional Dependency </p><p>I</p><p>If t is a tuple in a relation R and A is an attribute of R, then t<sub style="top: 0.1432em;">A </sub>is the value of attribute A in tuple t. </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Definition of Functional Dependency </p><p>II</p><p>If t is a tuple in a relation R and A is an attribute of R, then t<sub style="top: 0.1432em;">A </sub>is the value of attribute A in tuple t. The FD AdvisorId → AdvisorName holds in R if in every instance of R, for every pair of tuples t and u </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Definition of Functional Dependency </p><p>II</p><p>If t is a tuple in a relation R and A is an attribute of R, then t<sub style="top: 0.1432em;">A </sub>is the value of attribute A in tuple t. The FD AdvisorId → AdvisorName holds in R if in every instance of R, for every pair of tuples t and u </p><p>if t<sub style="top: 0.1364em;">AdvisorId </sub>= u<sub style="top: 0.1364em;">AdvisorId</sub>, then t<sub style="top: 0.1364em;">AdvisorName </sub>= u<sub style="top: 0.1364em;">AdvisorName </sub></p><p>.</p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p><p>Basics of FDs </p><p></p><ul style="display: flex;"><li style="flex:1">Manipulating FDs </li><li style="flex:1">Closures and Keys </li><li style="flex:1">Minimal Bases </li></ul><p></p><p>Definition of Functional Dependencies </p><p>A functional dependency (FD) on a relation R is a statement </p><p>I</p><p>If two tuples in R agree on attributes A<sub style="top: 0.1363em;">1</sub>, A<sub style="top: 0.1363em;">2</sub>, . . . A<sub style="top: 0.1363em;">n </sub>then they agree on attribute B. </p><p>I</p><p>Notation: A<sub style="top: 0.1363em;">1</sub>A<sub style="top: 0.1363em;">2 </sub>. . . A<sub style="top: 0.1363em;">n </sub>→ B </p><p></p><ul style="display: flex;"><li style="flex:1">T. M. Murali </li><li style="flex:1">October 19, 21 2009 </li><li style="flex:1">CS 4604: Functional Dependencies </li></ul><p></p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    106 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us