3

I'm currently studying for my exams and the trouble I am having is how to decompose a relation R with given functional dependencies into 2NF then 3NF.

For example for the following R and functional dependencies:

R = {A, B, C, D, E, F, G, H, I, J}

Functional dependencies F = ( {A, B} -> {C}, {A} -> {D, E}, {B} -> {F}, {F} -> {G, H}, {D} -> {I,J} }

I know firstly you have to work out the closure to find the key for R, which I have done and the key is {A,B} and now this is where I get stuck. My text book doesn't give any examples on how one can solve this except for definitions of 2NF and 3NF.

Example on how I can do this will be greatly appreciated.

0

1 Answer 1

7

2NF: Remove Partial Dependencies

R = {A, B, C, D, E, F, G, H, I, J} includes partial dependencies.

D and E depend only on A, F depends only on B, G, H, I and J don't depend on the key (directly) at all.

R0 = {A, B, C}

R1 = {A, D, E, I, J}

R2 = {B, F, G, H}

R0, R1, and R2 contain no partial dependencies (or repeating groups) so they are 2NF. However R1 and R2 are still an issue, because they contain transitive dependencies.

3NF: Remove Transitive Dependencies

I and J depend on D, not on the key of R1. Therefore you need to further normalize R1 as follows:

R1 = {A, D, E, I, J}

R1a = {A, D, E}

R1b = {D, I, J}

Similarly, G and H depend only on F so R2 must be decomposed as follows:

R2 = {B, F, G, H}

R2a = {B, F}

R2b = {F, G, H}

Now all of your remaining relations (R0, R1a, R1b, R2a, R2b) are devoid of repeating groups, partial dependencies and transitive dependencies. That means your relations are in 3NF.

When you are looking at an relation that hasn't been normalized and a series of dependencies, you can often normalize by inspection just by recognizing what your primary keys are going to be. Any attribute or combination of attributes that functionally determine other attributes are going to end up as primary keys. Once you've got your primary keys defined, you just need to figure out which non-key attributes go with each key. This is obvious from the statement of what your functional dependencies are.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.