patternMinor
Why is this relation in 3NF?
Viewed 0 times
thiswhyrelation3nf
Problem
I have a relation:
I know from looking at the answer key that this relation is in BCNF.
I'm going through the process of rigorously determining what normal form the relationship adheres to. It's clear to me why the relationship is in 1NF and 2NF, and if I assume it's in 3NF, BCNF follows easily.
However, the definition of 3NF states:
Every non-prime attribute is non-transitively dependent on every candidate key in the table.
But, as far as I can tell, both
There is an alternate definition of 3NF available on wikipedia:
A 3NF definition that is equivalent to Codd's, but expressed differently, was given by Carlo Zaniolo in 1982. This definition states that a table is in 3NF if and only if, for each of its functional dependencies X → A, at least one of the following conditions holds:
And the relation is clearly in 3NF by this definition (all of the functional dependencies are covered by "X is a superkey").
So why the discrepancy? How am I misapplying the definition? Please don't give me shortcuts that give me the answer in a way I don't want, unless you also help me understand why my application of 3NF (as described) is inaccurate.
R4 = {{T,U,V}, {T → U, U → T, T → V}}I know from looking at the answer key that this relation is in BCNF.
I'm going through the process of rigorously determining what normal form the relationship adheres to. It's clear to me why the relationship is in 1NF and 2NF, and if I assume it's in 3NF, BCNF follows easily.
However, the definition of 3NF states:
Every non-prime attribute is non-transitively dependent on every candidate key in the table.
But, as far as I can tell, both
{T} and {U} are candidate keys of the table, and {V} is thus transitively dependent on {U}.There is an alternate definition of 3NF available on wikipedia:
A 3NF definition that is equivalent to Codd's, but expressed differently, was given by Carlo Zaniolo in 1982. This definition states that a table is in 3NF if and only if, for each of its functional dependencies X → A, at least one of the following conditions holds:
- X contains A (that is, X → A is trivial functional dependency)
- X is a superkey
- Every element of A-X, the set difference between A and X, is a prime attribute (i.e., each column in A-X is contained in some candidate key)
And the relation is clearly in 3NF by this definition (all of the functional dependencies are covered by "X is a superkey").
So why the discrepancy? How am I misapplying the definition? Please don't give me shortcuts that give me the answer in a way I don't want, unless you also help me understand why my application of 3NF (as described) is inaccurate.
Solution
The mistake is in your understanding of transitive dependency. From Wikipedia: Transitive dependency
In mathematics, a transitive dependency is a functional dependency which holds by virtue of transitivity. A transitive dependency can occur only in a relation that has three or more attributes. Let A, B, and C designate three distinct attributes (or distinct collections of attributes) in the relation. Suppose all three of the following conditions hold:
Then the functional dependency A → C (which follows from 1 and 3 by the axiom of transitivity) is a transitive dependency.
In your case though, (2) does not hold:
Therefore
Note that Wikipedia has the correct definition but the struck-out claim is incorrect:
A transitive dependency can occur only in a relation that has three or more attributes.
There have to be at least 3 different sets, but that doesn't imply at least 3 attributes, it implies at least 2. And indeed for attribute set
This is a CK determining a non-prime attribute. So we don't have 3NF. It's also partial so we don't even have 2NF. (Which also contradicts the common misconceptions that all CKs simple implies 2NF and that 2 attributes implies 2NF.)
(Thanks to philipxy for pointing this out.)
In mathematics, a transitive dependency is a functional dependency which holds by virtue of transitivity. A transitive dependency can occur only in a relation that has three or more attributes. Let A, B, and C designate three distinct attributes (or distinct collections of attributes) in the relation. Suppose all three of the following conditions hold:
- A → B
- It is not the case that B → A
- B → C
Then the functional dependency A → C (which follows from 1 and 3 by the axiom of transitivity) is a transitive dependency.
In your case though, (2) does not hold:
U → T-- correct
- It is not the case that
T → U-- wrong
T → V-- correct
Therefore
{V} is NOT transitively dependent on {U}.Note that Wikipedia has the correct definition but the struck-out claim is incorrect:
A transitive dependency can occur only in a relation that has three or more attributes.
There have to be at least 3 different sets, but that doesn't imply at least 3 attributes, it implies at least 2. And indeed for attribute set
{X, Z} and candidate key X and functional dependency {} → Z (all rows have the same Z value) transitive dependency X → Z holds:X → {}-- correct
- It is not the case that
{} → X-- correct
{} → Z-- correct
This is a CK determining a non-prime attribute. So we don't have 3NF. It's also partial so we don't even have 2NF. (Which also contradicts the common misconceptions that all CKs simple implies 2NF and that 2 attributes implies 2NF.)
(Thanks to philipxy for pointing this out.)
Context
StackExchange Database Administrators Q#35070, answer score: 6
Revisions (0)
No revisions yet.