Title: Functional Dependency (FD)
1Functional Dependency (FD)
- FD imposes restrictions within a single schema.
- It restricts the data in the database follows
certain kind of rules. - Armstrongs Relations generalize six important
rules in describing the FD in schema
2Functional Dependency (FD)
- Consider the student relation
sid sname sfullname sprogram sdept
1001 stud_A stud_A Au BEng(COMP) 1
1002 stud_B stud_B Lo BEng(COMP) 1
1003 stud_C stud_C Ko BEng(ELEC) 2
1004 stud_D stud_D Ng BEng(ELEC) 2
3Functional Dependency (FD)
- Reflexivity
- If Y ? X ? schema(R) then we have FX?Y.
- Example
- sname ? sfullname gt F sfullname ? sname
- each students name (sname) is a subset of
his/her full name (sfullname). Hence we can
determine the students name from his/her full
name.
4Functional Dependency (FD)
- Augmentation
- If FX?Y and W is a (set of) attribute(s) in the
schema, then FXW?YW - Example
- F sid ? sprogram gt F sid, sdept ?
sprogram, sdept - A students student ID (sid) can determine
his/her program of study (sprogram). - Then the students ID together with his/her
belonging department can determine the program
he/she is studying together with the department
he/she belongs to.
5Functional Dependency (FD)
- Transitivity
- If FX?Y and FY?Z, then FX?Z.
- Example
- F sid ? sprogram and F sprogram ? sdeptthen
F sid ? sdept - Student identity number (sid) determines the
program (sprogram) he/she has registered, and
each program must refer to a department (sdept).
We can find the department that the student
belongs to by the student identity number.
6Functional Dependency (FD)
- Union
- If FX?Y and FX?Z, then FX?YZ.
- Example
- F sid ? sname and F sid ? sprogramthen F
sid ? sname, sprogram - Student ID (sid) determines the name of the
student (sname), it also determines the program
the student has registered (sprogram). - Thus if we know the student ID, we can altogether
know the student name and the program of that
student.
7Functional Dependency (FD)
- Decomposition
- If FX?YZ, then FX?Y and FX?Z.
- Example
- F sid ? sprogram, sdeptthen F sid ? sprogram
and F sid ? sdept. - Student ID (sid) determines the program
registered (sprogram) and the department he/she
belongs to (sdept). - With this student ID, we can find the program
he/she has registered and the department he/she
belongs to separately.
8Functional Dependency (FD)
- Pseudo-transitivity
- If FX?Y and FYW?Z, then FXW?Z.
- Example
- If F sid ? sname and F sname, sprogram ?
sdept , then F sid, sprogram ? sdept - Student ID (sid) determines the student name
(sname). Knowing the student name and the program
that he/she has registered (sprogram), we can
know the department he/she belongs to (sdept). - Then, if we know the student ID of the student
and the the registered program, we can know the
department this student belongs to.