Understanding 3NF: plain English please

前端 未结 4 1119
花落未央
花落未央 2021-02-04 17:06

I am working through an example problem in which we are trying to identify which of the following relations is in Third Normal Form (3NF). Here are the relations we are given:

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-04 17:39

    A simplified expression of 3NF is "A relation is in 3NF if every attribute transitively dependent on a key is a key attribute."1 A key attribute is an attribute that's part of any candidate key.

    R3 is one of the simpler ones to analyze with respect to 3NF.

    R3(ABCD)

    • C -> B
    • A -> B
    • CD -> A
    • BCD -> A

    The only candidate key is CD.

    • Is there a transitive dependency? Yes, there is: CD->A, and A->B. B is transitively dependent on the key.
    • Is B a key attribute? No, it's not; CD is the only key.

    So R3 is not in 3NF.

    R4 is similar. C is the only candidate key.

    • Is there a transitive dependency? Yes, there is: C->B, and B->A.
    • Is A a key attribute? No, it's not; C is the only key.

    So R4 is not in 3NF.

    In R1, the candidate keys are AC and AD.

    • Is there a transitive dependency? Yes, there is: AC->D, and D->C.
    • Is C a key attribute? Yes, it is.

    So R1 is in 3NF.


    1. "A New Normal Form for the Design of Relational Schemata", Carlo Zaniolo, in ACM Transactions on Database Systems, Vol. 7, No. 3, September 1982, p 492. More recent work uses prime attribute to refer to attributes that are part of any candidate key and non-prime attribute to refer to attributes that are not part of any candidate key.

提交回复
热议问题