Lab 14
Lab 14
XY
If X Y then X Y
This is trivial dependency
E.g., SSN SSN
E.g., {Vehicle VIN, Reg} {Vehicle VIN, Reg}
E.g., {Vehicle VIN, Reg} Reg
This means that a relation with multi-valued (or set-valued) attributes is not
in 1NF.
1NF Example
Name Age Children Years Company Title
name(s)
J Smith 40 Alice 75-80 Abc Chem Engineer
H. 50 Ben,Donna 70-79 Xerox Accountant
Nicholas
Solution:
e.g.,
Relation: Sales (Dept, Item , Price)
violated.
How to Achieve 2NF
To convert a relation into 2NF, dept item price
separate the non-key attribute D1 I1 p1
that violates 2NF into a new
D1 I2 p2
relation together with its
partially dependent key D2 I2 p2
attribute. The partially
dependent key attribute will
be the primary key of the new
dept item item price
relation.
D1 I1 I1 p1
D1 I2 I2 p2
D2 I2
3NF (Third Normal Form)
Transitive dependency:
If A B and B C, then A C
Key: SSN
DF:
SSN{Ename, Bdate, ADD, DNUM}
DNUM{DNAME, DMGRSSN}
Then we have transitive dependencies:
SSN{DNAME, DMGRSSN}
Therefore, this relation violates 3NF
How to Achieve 3NF
Separate the non-key attributes that violate 3NF into a new relation
together with their directly dependent attribute. The directly dependent
attribute will be the key in the new relation.
In a nontrivial FD, the left hand side must be a super key of the
relation.
BCNF Grades Example 1
Relation: Grades(StudId, SSN, Course, Grades)
I S C G
Keys: {I, C}; {S, C}
FD: {I, C} G; {S, C} G; IS; SI
In 1NF, 2NF, and 3NF
But S I (a FD) violates BCNF definition