In: Computer Science
How do you transform from first normal form to second normal form?
Answer: To transform the first normal form into the second normal form, remove the partial dependency.
A relation is said to be in second normal form if there is no partial dependency in the relation.
Partial dependency: When a non-prime attribute functionally dependent on the part of a candidate key.
Example: Consider a relation R{ABCDE} with functional dependency A ->C, AB -> D, AB->E
The candidate key for the relation R is AB. C, D, E are a nonprime attribute. C is functionally dependent on A. A is part of the candidate key. So, due to the existence of the partial dependency A ->C this relation is not in the second normal form.
To convert this relation into the second normal form we need to remove the partial dependency.
First, find the closure of A
(A)+ -> AC
Now decompose the relation to remove partial dependency and create a separate relation.
Now in both the relation R1 and R2 there is no partial dependency. The candidate key of R1 is AB and for R2 is A