Question

When can a BCNF decomposition not preserve functional dependency... I am trying to figure this out for say R=(V,W,X,Y,Z)

Was it helpful?

Solution

The point of a BCNF decomposition is to eliminate functional dependencies that are not of the form key -> everything else

So if a table has a FD, say A -> B, such that A is not a key, it means you're storing redundant data in your table. As a result, you create a new table with columns A and B, with A being the key, then you remove B from your original table.

As a result of this change you would no longer suffer from deletion anomalies, nor would you have to update multiple rows just to make a change to the A -> B relationship.

So for a trivial, naive example, let's say you have a employee table with columns:

 employeeId   name   jobTitle    salary

Assume that jobTitle -> salary that is, everyone with the same job title always makes the same salary. Assume a jobTitle of "developer" equates to a salary of $90,000. If you have 20 developers in your database, it would be silly to store the same redundant value of $90,000 for each row. So, you drop the salary column from your employees table, and create a new salary table with:

 jobTitle_[key]   salary

Then, to get a salary on an employee, you look it up in the salary table.

OTHER TIPS

Taken from Database Design and Relational Theory:

R = (S, J, T)

{S, J} -> {T}
{T} -> {J}

This is not in BCNF, since T -> J holds and T is not a key.

Decomposing it into R1 = (T, J) and R2 = (T, S) with {T} and {T, S} being keys resp. leads to BCNF.

However, the dependency {S, J} -> {T} is lost.

R(a b c d e) with FDs { A->B,AC->D,BD->E}. In this relation AC is a Candidate key and This relation is not in 2NF as non prime B is partial dependent on key(AC). To convert this relation into bcnf decompose into two relations : R1(a b ) {a->b} key = a R2(a c d e) {ac->de} key =a Both R1 and R2 are in bcnf as every determinant is a key, but they are not dependency preserving as bd->e is lost.

Schema R=(V,W,X,Y,Z)

Functional dependencies:

V,W -> X
Y,Z -> X
  W -> Y

Decompose to BCNF and you will see that all FD's can not be preserved in a single decomposition.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top