1) What is 4NF?, explain with an example ?
ANSWER:
Fourth normal form :
A relation schema R is in fourth normal form (4NF) with respect to a
set D of functional and multivalued dependencies if, for all multivalued
dependencies in D+ of the form α →→ β, where α ⊆ R and β ⊆ R, at
least one of the following holds
α →→ β is a trivial multivalued dependency.
α is a superkey for schema R.
EXAMPLE :
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)
and
hobbies(employee#, hobby)
1)skills(employee#, skill)
Employee# skills
1 Programming
1 Analysis
2 Analysis
2 Management
2)hobbies(employee#, hobby)
Employee# hobbies
1 Golf
1 Bowling
2 Golf
2 Gardening
2) What is 5NF?, explain with an example ?
A Relation schema R is said to be 5NF if for every join
dependency {R1, R2, ..., Rn} that holds R, one the following is
true
Ri = R for some i.
The join dependency is implied by the set of FD, over R in
which the left side is key of R.
EXAMPLE:
Take the following table structure as an example of a buying
table.
buyer vendor item
Problem:- The
problem with the
above table
structure is Sally Liz Claiborne Blouses that if
Claiborne starts to
sell Jeans Mary Liz Claiborne Blouses then how
many records
Sally Jordach Jeans
must you create to
record this Mary Jordach Jeans fact? The
problem is there are
pair wise Sally Jordach Sneakers cyclical
dependencies in the primary key. That is, in order to determine
the item you must know the buyer and vendor, and to
determine the vendor you must know the buyer and the item,
and finally to know the buyer you must know the vendor and
the item.
Solution:- The solution is to break this one table into three
tables;
Buyer-Vendor,
Buyer-Item,
and Vendor-Item.
So following tables are in the 5NF
buyer item
buyer vendor
Sally Blouses
Sally Liz Claiborne
Mary Blouses
Mary Liz Claiborne
Sally Jeans
Sally Jordach
Mary Jeans
Mary Jordach
vendor item
.
Liz Claiborne Blouses
Jordach Jeans
Jordach Sneakers
3) What is multivalued dependencies?
Let R be a relation schema and let α ⊆ R and β ⊆ R.
The multivalued dependency α →→ β
holds on R if, in any legal relation r(R), for all pairs of tuples t1
and t2 in r such that
t1[α] = t2[α],
there exist tuples t3 and t4 in r such that
t1[α] = t2[α] = t3[α] = t4[α]
t3[β] = t1[β]
t3[R − β] = t2[R − β]
t4[β] = t2[β]
t4[R − β] = t1[R − β]
If the multivalued dependency α →→ β is satisfied by all
relations on schema R, then α →→ β is a trivial multivalued
dependency on schema R. Thus, α →→ β is trivial if β ⊆ α or β
∪ α = R.
Every functional dependency is a multivalued dependency.
As with functional dependencies, we use multivalued
dependencies in two ways:
1. To test relations to determine whether they are legal under a
given set of functional and multivalued dependencies
2. To specify constraints on the set of legal relations; we shall
thus concern ourselves with only those relations that satisfy a
given set of functional and multivalued
dependencies