Documente Academic
Documente Profesional
Documente Cultură
Manipulating FDs
Minimal Bases
Functional Dependencies
T. M. Murali
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS!
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS! The class is slow (no 3NF yet). Why are we doing design before learning normalisation? It seems odd to teach relational models after SQL.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS! The class is slow (no 3NF yet). Why are we doing design before learning normalisation? It seems odd to teach relational models after SQL. Homework grading is strict/uneven.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS! The class is slow (no 3NF yet). Why are we doing design before learning normalisation? It seems odd to teach relational models after SQL. Homework grading is strict/uneven. Increase amount of examples/hands-on work.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS! The class is slow (no 3NF yet). Why are we doing design before learning normalisation? It seems odd to teach relational models after SQL. Homework grading is strict/uneven. Increase amount of examples/hands-on work. Make the lectures more interactive.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS! The class is slow (no 3NF yet). Why are we doing design before learning normalisation? It seems odd to teach relational models after SQL. Homework grading is strict/uneven. Increase amount of examples/hands-on work. Make the lectures more interactive. Oce hours change a lot.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS! The class is slow (no 3NF yet). Why are we doing design before learning normalisation? It seems odd to teach relational models after SQL. Homework grading is strict/uneven. Increase amount of examples/hands-on work. Make the lectures more interactive. Oce hours change a lot. Wish the project was free form.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Midterm Review
The database server set up is driving me NUTS! The class is slow (no 3NF yet). Why are we doing design before learning normalisation? It seems odd to teach relational models after SQL. Homework grading is strict/uneven. Increase amount of examples/hands-on work. Make the lectures more interactive. Oce hours change a lot. Wish the project was free form. It would be nice to have a table of RA symbols and E/R diagram shapes.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Example
Name Id Name Id
Students
Advises
Advisors
Favourite
Convert to relations:
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Example
Name Id Name Id
Students
Advises
Advisors
Favourite
Convert to relations: Students(Id, Name) Advisors(Id, Name) Advises(StudentId, AdvisorId) Favourite(StudentId, AdvisorId)
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Example
Name Id Name Id
Students
Advises
Advisors
Favourite
Convert to relations: Students(Id, Name) Advisors(Id, Name) Advises(StudentId, AdvisorId) Favourite(StudentId, AdvisorId) Suppose we perversely decide to convert Students, Advises, and Favourite into one relation. Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId)
T. M. Murali October 18, 25, 2010 CS 4604: Functional Dependencies
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Basics of FDs
Manipulating FDs
Minimal Bases
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.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
If t is a tuple in a relation R and A is an attribute of R , then tA 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
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
If t is a tuple in a relation R and A is an attribute of R , then tA 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 if tAdvisorId = uAdvisorId , then tAdvisorName = uAdvisorName .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Examples of FDs
What FDs can we assert for the relation
Courses(Number, DeptName, CourseName, Classroom, Enrollment) Number 4604 4604 4604 2604 2604 DeptName CS Dance English CS Physics CourseName Databases Tree Dancing The Basis of Data Data Structures Dark Matter Classroom TORG 1020 Drilleld Williams 44 MCB 114 Williams 44 Enrollment 45 45 45 100 100
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Examples of FDs
What FDs can we assert for the relation
Courses(Number, DeptName, CourseName, Classroom, Enrollment) Number 4604 4604 4604 2604 2604 DeptName CS Dance English CS Physics CourseName Databases Tree Dancing The Basis of Data Data Structures Dark Matter Classroom TORG 1020 Drilleld Williams 44 MCB 114 Williams 44 Enrollment 45 45 45 100 100
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Examples of FDs
What FDs can we assert for the relation
Courses(Number, DeptName, CourseName, Classroom, Enrollment) Number 4604 4604 4604 2604 2604 DeptName CS Dance English CS Physics CourseName Databases Tree Dancing The Basis of Data Data Structures Dark Matter Classroom TORG 1020 Drilleld Williams 44 MCB 114 Williams 44 Enrollment 45 45 45 100 100
DeptName CourseName DeptName Classroom DeptName Enrollment DeptName CourseName Classroom Enrollment
October 18, 25, 2010 CS 4604: Functional Dependencies
Basics of FDs
Manipulating FDs
Minimal Bases
Examples of FDs
What FDs can we assert for the relation
Courses(Number, DeptName, CourseName, Classroom, Enrollment) Number 4604 4604 4604 2604 2604 DeptName CS Dance English CS Physics CourseName Databases Tree Dancing The Basis of Data Data Structures Dark Matter Classroom TORG 1020 Drilleld Williams 44 MCB 114 Williams 44 Enrollment 45 45 45 100 100
Number DeptName CourseName Number DeptName Classroom Number DeptName Enrollment Number DeptName CourseName Classroom Enrollment Is Number Enrollment an FD?
T. M. Murali October 18, 25, 2010 CS 4604: Functional Dependencies
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Keyness of attributes. Domain and application constraints. Real world constraints, e.g., ProfessorID Time Classroom
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Denition of Keys
FDs allow us to formally dene keys. A set of attributes {A1 , A2 , . . . An } is a key for a relation R if Uniqueness {A1 , A2 , . . . An } functionally determine all the other attributes of R and Minimality no proper subset of {A1 , A2 , . . . An } functionally determines all the other attributes of R .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Denition of Keys
FDs allow us to formally dene keys. A set of attributes {A1 , A2 , . . . An } is a key for a relation R if Uniqueness {A1 , A2 , . . . An } functionally determine all the other attributes of R and Minimality no proper subset of {A1 , A2 , . . . An } functionally determines all the other attributes of R . A superkey is a set of attributes that has the uniqueness property but is not necessarily minimal. If a relation has multiple keys, specify one to be the primary key. Convention: in a relational schema, underline the attributes of the primary key. If a key has only one attribute A, we say that A rather than {A} is a key.
T. M. Murali October 18, 25, 2010 CS 4604: Functional Dependencies
Basics of FDs
Manipulating FDs
Minimal Bases
Example of Keys
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Example of Keys
What is the key for Courses(Number, DeptName, CourseName, Classroom, Enrollment)? The key is {Number, DeptName}.
These attributes functionally determine every other attribute. No proper subset of {Number, DeptName} has this property.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Example of Keys
What is the key for Courses(Number, DeptName, CourseName, Classroom, Enrollment)? The key is {Number, DeptName}.
These attributes functionally determine every other attribute. No proper subset of {Number, DeptName} has this property.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Example of Keys
What is the key for Courses(Number, DeptName, CourseName, Classroom, Enrollment)? The key is {Number, DeptName}.
These attributes functionally determine every other attribute. No proper subset of {Number, DeptName} has this property.
What is the key for Teach(Number, DepartmentName, ProfessorName, Classroom)? The key is {Number, DepartmentName}. Why?
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
If the relationship R is multiway, we need to reason about the FDs that R satises.
There is no simple rule. If R has an arrow towards entity set E , at least one key for the relation for R excludes the key for E .
T. M. Murali October 18, 25, 2010 CS 4604: Functional Dependencies
Basics of FDs
Manipulating FDs
Minimal Bases
Learn how to reason about FDs. Dene rules for deriving new FDs from a given set of FDs. Next class: use these rules to remove anomalies from relational designs.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Learn how to reason about FDs. Dene rules for deriving new FDs from a given set of FDs. Next class: use these rules to remove anomalies from relational designs. Example: A relation R with attributes A, B , and C , satises the FDs A B and B C . What other FDs does it satisfy?
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Learn how to reason about FDs. Dene rules for deriving new FDs from a given set of FDs. Next class: use these rules to remove anomalies from relational designs. Example: A relation R with attributes A, B , and C , satises the FDs A B and B C . What other FDs does it satisfy? A C .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Learn how to reason about FDs. Dene rules for deriving new FDs from a given set of FDs. Next class: use these rules to remove anomalies from relational designs. Example: A relation R with attributes A, B , and C , satises the FDs A B and B C . What other FDs does it satisfy? A C . What is the key for R ?
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Learn how to reason about FDs. Dene rules for deriving new FDs from a given set of FDs. Next class: use these rules to remove anomalies from relational designs. Example: A relation R with attributes A, B , and C , satises the FDs A B and B C . What other FDs does it satisfy? A C . What is the key for R ? A, because A B and A C .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Equivalence of FDs
An FD F follows from a set of FDs T if every relation instance that satises all the FDs in T also satises F .
A C follows from T = {A B , B C }. Does T follow from S ?
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Equivalence of FDs
An FD F follows from a set of FDs T if every relation instance that satises all the FDs in T also satises F .
A C follows from T = {A B , B C }. Does T follow from S ?
Two sets of FDs S and T are equivalent if each FD in S follows from T and each FD in T follows from S .
S = {A B , B C , A C } and T = {A B , B C } are equivalent.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Equivalence of FDs
An FD F follows from a set of FDs T if every relation instance that satises all the FDs in T also satises F .
A C follows from T = {A B , B C }. Does T follow from S ?
Two sets of FDs S and T are equivalent if each FD in S follows from T and each FD in T follows from S .
S = {A B , B C , A C } and T = {A B , B C } are equivalent.
These notions are useful in deriving new FDs from a given set of FDs.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Can we split and combine left hand sides of FDs? For the relation Courses, is the FD Number DeptName CourseName equivalent to the set of FDs {Number CourseName, DeptName CourseName}?
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Can we split and combine left hand sides of FDs? For the relation Courses, is the FD Number DeptName CourseName equivalent to the set of FDs {Number CourseName, DeptName CourseName}? NO!
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As,
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An }.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An }. non-trivial if at least one B is not among the As,
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An }. non-trivial if at least one B is not among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An }. non-trivial if at least one B is not among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = . completely non-trivial if none of the B s are among the As,
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An }. non-trivial if at least one B is not among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = . completely non-trivial if none of the B s are among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An }. non-trivial if at least one B is not among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = . completely non-trivial if none of the B s are among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = . What good are trivial and non-trivial dependencies?
Trivial dependencies are always true. They help simplify reasoning about FDs.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Triviality of FDs
An FD A1 A2 . . . An B1 B2 . . . Bm is trivial if the B s are a subset of the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An }. non-trivial if at least one B is not among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = . completely non-trivial if none of the B s are among the As, i.e., {B1 , B2 , . . . Bn } {A1 , A2 , . . . An } = . What good are trivial and non-trivial dependencies?
Trivial dependencies are always true. They help simplify reasoning about FDs.
Trivial dependency rule: The FD A1 A2 . . . An B1 B2 . . . Bm is equivalent to the FD A1 A2 . . . An C1 C2 . . . Ck , where the C s are those B s that are not As, i.e., {C1 , C2 , . . . , Ck } = {B1 , B2 , . . . , Bm } {A1 , A2 , . . . , An }.
T. M. Murali October 18, 25, 2010 CS 4604: Functional Dependencies
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Given a set of attributes {A1 , A2 , . . . , An } and a set of FDs S , the closure of {A1 , A2 , . . . , An } under the FDs in S is the set of attributes {B1 , B2 , . . . , Bm } such that for 1 i m, the FD A1 A2 . . . An Bi follows from S . the closure is denoted by {A1 , A2 , . . . , An }+ .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Given a set of attributes {A1 , A2 , . . . , An } and a set of FDs S , the closure of {A1 , A2 , . . . , An } under the FDs in S is the set of attributes {B1 , B2 , . . . , Bm } such that for 1 i m, the FD A1 A2 . . . An Bi follows from S . the closure is denoted by {A1 , A2 , . . . , An }+ . Which attributes must {A1 , A2 , . . . , An }+ contain at a minimum?
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Given a set of attributes {A1 , A2 , . . . , An } and a set of FDs S , the closure of {A1 , A2 , . . . , An } under the FDs in S is the set of attributes {B1 , B2 , . . . , Bm } such that for 1 i m, the FD A1 A2 . . . An Bi follows from S . the closure is denoted by {A1 , A2 , . . . , An }+ . Which attributes must {A1 , A2 , . . . , An }+ contain at a minimum? {A1 , A2 , . . . , An }. Why?
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Given a set of attributes {A1 , A2 , . . . , An } and a set of FDs S , the closure of {A1 , A2 , . . . , An } under the FDs in S is the set of attributes {B1 , B2 , . . . , Bm } such that for 1 i m, the FD A1 A2 . . . An Bi follows from S . the closure is denoted by {A1 , A2 , . . . , An }+ . Which attributes must {A1 , A2 , . . . , An }+ contain at a minimum? {A1 , A2 , . . . , An }. Why? A1 A2 . . . An Ai is a trivial FD.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
2. Check if a new FD A1 A2 . . . An B follows from a set of FDs S : simply check if B is in {A1 , A2 , . . . An }+ under S .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
2. Check if a new FD A1 A2 . . . An B follows from a set of FDs S : simply check if B is in {A1 , A2 , . . . An }+ under S . 3. Procedurally dene keys.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
2. Check if a new FD A1 A2 . . . An B follows from a set of FDs S : simply check if B is in {A1 , A2 , . . . An }+ under S . 3. Procedurally dene keys. A set of attributes X is a key for a relation R if and only if
{X } is the set of all attributes of R and + for no attribute A X is {X {A}} the set of all attributes of R .
T. M. Murali October 18, 25, 2010 CS 4604: Functional Dependencies
Basics of FDs
Manipulating FDs
Minimal Bases
Consider the bad relation Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId). What are the FDs that hold in this relation? Id Name Id FavouriteAdvisorId AdvisorId AdvisorName
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Consider the bad relation Students(Id, Name, AdvisorId, AdvisorName, FavouriteAdvisorId). What are the FDs that hold in this relation? Id Name Id FavouriteAdvisorId AdvisorId AdvisorName To compute the key for this relation,
1. Compute the closures for all sets of attributes. 2. Find the minimal set of attributes whose closure is the set of all attributes.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Armstrongs Axioms
We can use closures of attributes to determine if any FD follows from a given set of FDs. Armstrongs axioms: complete set of inference rules from which it is possible to derive every FD that follows from a given set:
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Armstrongs Axioms
We can use closures of attributes to determine if any FD follows from a given set of FDs. Armstrongs axioms: complete set of inference rules from which it is possible to derive every FD that follows from a given set: Reexivity If {B1 , B2 , . . . , Bm } {A1 , A2 , . . . , An }, then A1 A2 . . . Am B1 B2 . . . Bm (Trivial FDs).
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Armstrongs Axioms
We can use closures of attributes to determine if any FD follows from a given set of FDs. Armstrongs axioms: complete set of inference rules from which it is possible to derive every FD that follows from a given set: Reexivity If {B1 , B2 , . . . , Bm } {A1 , A2 , . . . , An }, then A1 A2 . . . Am B1 B2 . . . Bm (Trivial FDs). Augmentation If A1 A2 . . . Am B1 B2 . . . Bm , then A1 A2 . . . Am C1 C2 . . . Ck B1 B2 . . . Bm C1 C2 . . . Ck , for any set of attributes {C1 , C2 , . . . , Ck }.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Armstrongs Axioms
We can use closures of attributes to determine if any FD follows from a given set of FDs. Armstrongs axioms: complete set of inference rules from which it is possible to derive every FD that follows from a given set: Reexivity If {B1 , B2 , . . . , Bm } {A1 , A2 , . . . , An }, then A1 A2 . . . Am B1 B2 . . . Bm (Trivial FDs). Augmentation If A1 A2 . . . Am B1 B2 . . . Bm , then A1 A2 . . . Am C1 C2 . . . Ck B1 B2 . . . Bm C1 C2 . . . Ck , for any set of attributes {C1 , C2 , . . . , Ck }. Transitivity If A1 A2 . . . An B1 B2 . . . Bm and B1 B2 . . . Bm C1 C2 . . . Ck then A1 A2 . . . An C1 C2 . . . Ck .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Dierences in Notation
Relation schema R (A1 , A2 , A3 ): parentheses surround attributes, attributes separated by commas. Set of attributes {A1 , A2 , A3 }: curly braces surround attributes, attributes separated by commas. FD A1 A2 A3 : no parentheses or curly braces, attributes separated by spaces, arrows separates left hand side and right hand side. Set of FDs {A1 A2 A3 , A2 A1 }: curly braces surround FDs, FDs separated by commas.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Minimal Basis
A relation may have a large set of equivalent sets of FDs. If we are given a set S of FDs, then any set of FDs that is equivalent to S is called a basis of S .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Minimal Basis
A relation may have a large set of equivalent sets of FDs. If we are given a set S of FDs, then any set of FDs that is equivalent to S is called a basis of S . We will limit ourselves to bases in which each FD has only one attribute on the right hand side.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
Minimal Basis
A relation may have a large set of equivalent sets of FDs. If we are given a set S of FDs, then any set of FDs that is equivalent to S is called a basis of S . We will limit ourselves to bases in which each FD has only one attribute on the right hand side. A set B of FDs is a minimal basis for a relation R if
1. Every FD in B has one attribute on the right hand side. 2. If we remove any FD from B , then the result is not a basis. 3. If for any FD in B , we remove one or more attributes from the left hand side of the FD, then the result is not a basis.
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
R (A, B , C ) is a relation such that each attribute functionally determines the other two attributes. What are the FDs that hold in R and what are the minimal bases? (Assume only one attribute on the right-hand side, only non-trivial FDs)
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
R (A, B , C ) is a relation such that each attribute functionally determines the other two attributes. What are the FDs that hold in R and what are the minimal bases? (Assume only one attribute on the right-hand side, only non-trivial FDs) FDs:
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
R (A, B , C ) is a relation such that each attribute functionally determines the other two attributes. What are the FDs that hold in R and what are the minimal bases? (Assume only one attribute on the right-hand side, only non-trivial FDs) FDs: A B , A C , B A, B C , C A, C B ,
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
R (A, B , C ) is a relation such that each attribute functionally determines the other two attributes. What are the FDs that hold in R and what are the minimal bases? (Assume only one attribute on the right-hand side, only non-trivial FDs) FDs: A B , A C , B A, B C , C A, C B , AB C , BC A, AC B .
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
R (A, B , C ) is a relation such that each attribute functionally determines the other two attributes. What are the FDs that hold in R and what are the minimal bases? (Assume only one attribute on the right-hand side, only non-trivial FDs) FDs: A B , A C , B A, B C , C A, C B , AB C , BC A, AC B . Minimal bases:
T. M. Murali
Basics of FDs
Manipulating FDs
Minimal Bases
R (A, B , C ) is a relation such that each attribute functionally determines the other two attributes. What are the FDs that hold in R and what are the minimal bases? (Assume only one attribute on the right-hand side, only non-trivial FDs) FDs: A B , A C , B A, B C , C A, C B , AB C , BC A, AC B . Minimal bases: {A B , B A, B C , C B }, {A B , B C , C A}, and others.
T. M. Murali