Article Directory
A functional dependency
Functional dependencies (functional dependency, FD) is an integrity constraint is a constraint relationship between the real world things property, it is widely exists in the real world.
1.1 Functional Dependencies
1.2 trivial dependence and non-trivial function
1.3 complete and partial functional dependency functional dependency
Illustration:
- Totally dependent on
the student number, course number can uniquely identify a course fraction:
{studentNo, courseNo} -> Score ;
can uniquely identify a student number of student name:
studentNo-> studentName ;
can be uniquely identified by a program number course name:
courseNo-> CourseName .
studentNo, courseNo are {studentNo, courseNo} subset,
but studentNo / courseNo can not be uniquely determined Score . - 部分依赖
{studentNo,courseNo}—>studentName;
{studentNo,courseNo}—>courseName;
studentNo 、courseNo都是 {studentNo,courseNo}的子集,
studentNo—>studentName;
courseNo—>courseName
1.4 传递函数依赖
示例说明:
- 传递依赖
由学生学号可以唯一确定一个班级编号、班级名称、学院名称:
studentNo—>{classNo, className, institute};
由班级编号可以唯一确定一个班级名称、学院名称:
classNo—>{className, institute};
且由classNo不能唯一确定studentNo。
从上述两个函数依赖关系中可以得出:
studentNo—>{className, institute},故存在传递依赖。
2 范式(Normal Form)
基于函数依赖理论,关系模式可分成第一范式(1NF),第二范式(2NF),第三范式(3NF)和 Boyce-Codd 范式(BCNF)。这几种范式的要求一个比一个严格,它们之间的联系为BCNF ⊂ 3NF ⊂ 2NF ⊂ 1NF。即满足 BCNF 范式的关系一定满足3NF范式,满足3NF 范式的关系一定满足2NF范式,满足2NF范式的关系一定满足1NF范式。
1NF | Each field corresponding to the attribute values are inseparable |
2NF | All non-primary attributes are totally dependent on the candidate code |
3NF | Non-primary property must rely solely on the candidate code and directly dependent on (allowed transmission property dependence on the primary candidate code and partly dependent) |
BCNF | Elimination of the main properties of the bond portion of the original transmission dependence relationship |
2.1 The first paradigm (1NF) - Code
2.2 The second paradigm (2NF) - all codes
2.3 The third paradigm (3NF) - only Code
2.4 Boyce-Codd paradigm (the BCNF)
Meet BCNF conditions:
- All non-primary attributes are fully dependent on the function of each of the candidate key;
- All main attributes are fully dependent on the function of each of the candidate key does not contain it;
- No function is completely independent of any property of a set of non-candidate key attributes.