|
A table is in fourth normal form (4NF) if and only if it is in BCNF and contains no more than one multi-valued dependency.
- Anomalies can occur in relations in BCNF if there is more than one multi-valued dependency.
- If A--->B and A--->C but B and C are unrelated, ie A--->(B,C) is false, then we have more than one multi-valued dependency.
- A relation is in 4NF when it is in BCNF and has no more than one multi-valued dependency.
Example to understand 4NF:-
Take the following table structure as an example:
info(employee#, skills, hobbies)
Take the following table:
employee# | skills | hobbies |
|---|
1
|
Programming
|
Golf
|
1
|
Programming
|
Bowling
|
1
|
Analysis
|
Golf
|
1
|
Analysis
|
Bowling
|
2
|
Analysis
|
Golf
|
2
|
Analysis
|
Gardening
|
2
|
Management
|
Golf
|
2
|
Management
|
Gardening
|
This table is difficult to maintain since adding a new hobby requires multiple new rows corresponding to each skill. This problem is created by the pair of multi-valued dependencies EMPLOYEE#--->SKILLS and EMPLOYEE#--->HOBBIES. A much better alternative would be to decompose INFO into two relations:
skills(employee#, skill)
employee# | skills |
|---|
1
|
Programming
|
1
|
Analysis
|
2
|
Analysis
|
2
|
Management
|
hobbies(employee#, hobby)
employee# | hobbies |
|---|
1
|
Golf
|
1
|
Bowling
|
2
|
Golf
|
2
|
Gardening
|
|