Functional dependency

  1. Definition of function dependency:
    If there is a pattern (id, name), where id is the main code.
    Then the functional dependency can be written as id-> name
  2. Satisfying the condition of functional dependence (a-> b)
    For all tuple pairs t1 and t2 in the instance, if t1 [a] = t2 [a], then t1 [b] = t2 [b]
  3. The benefits of functional dependencies
    can represent constraints that cannot be expressed in supercode.
    Such as stu (id, name, sex, apartment), where id is the main code, assuming that there are only two apartments (men and women).
    Then sex-> apartment is established, because boys can only live in boys' dormitory. So gender can constrain apartment buildings
  4. Ordinary functional dependence
    If a contains b, then the functional dependence a-> b is called ordinary
  5. Armstrong axiom
    • Reflexive law: if a is a set of attributes and a contains b, then a-> b
    • Supplementary law: if a-> b and r is an attribute set, then ar-> br
    • Transfer law: if a-> b, b-> c, then a-> c holds
    • inference
      • Merger law: if a-> b, a-> c, then a-> bc
      • Decomposition law: if a-> bc, then a-> b, a-> c
      • Pseudo-transfer law: if a-> b, bc-> r, then ac-> r

Simple example

A B C D
a1 b1 c1 D1
a1 b2 c1 d2
a2 b2 c2 d2
a2 b3 c2 d3
a3 b3 c2 d4

It can be said that A-> C (for a3 and c2, because there is no other tuple A whose value is a3, so a3 can uniquely determine c2)
C-> A is not satisfied.
AB-> C, AB-> D established

发布了161 篇原创文章 · 获赞 68 · 访问量 2万+

Guess you like

Origin blog.csdn.net/qq_43179428/article/details/105562045