0% found this document useful (0 votes)
10 views7 pages

COMP2714 Tutorial-4-2-Normalization

Uploaded by

epicfacegotyou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views7 pages

COMP2714 Tutorial-4-2-Normalization

Uploaded by

epicfacegotyou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

COMP2714 Tutorial 4.

2: Normalisation – Solutions

Introduction
Purpose: The purpose of this tutorial is to provide you with experience in normalising to
both BCNF and 3NF. You will also become familiar with the process of computing
minimal cover and how this can be used to complete a 3NF decomposition via
synthesis.

Learning Outcomes: By the end of this tutorial you will be able to:
• Decompose a relation into BCNF using the top-down approach
• Compute the minimal cover of a relation given a set of functional
dependencies
• Decompose a relation into 3NF using the bottom-up approach

Section A: BCNF Decomposition


Normalise the following relations into BCNF using the “top-down” approach, also
known as the “tree” approach. You should consider the functional dependencies in
the order which they are provided.
Note: Other correct decompositions could be derived by following a different order.
A.1 R [A, B, C, D, E]
{A} à {C}
{A, B} à {D, E}

AB+ = {ABCDE} (AB is the candidate key)

Final answer:
R1 [A, C] {A} → {C}
R2 [A, B, D, E] {A, B} → {D, E}

A.2 R [A, B, C, D, E]
{A} à {B}
{C} à {D, E}

AC+ = {ABCDE} (AC is the candidate key)

Final answer:
R1[A, B] {A} → {B}
R3[C, D, E] {C} → {D, E}
R4[A, C] No non-trivial FD

A.3 R [A, B, C, D, E, F]
{A} à {B, C}
{C} à {D, E}
{E} à {F}

A+ = {ABCDEF} (A is the candidate key)

{E} → {F} is lost

Final answer:
R1[C, D, E] {C} → {D, E}
R3[C, F] {C} → {F} [Implicit FD]
R4[A, B, C] {A} → {B, C}

A.4 R [A, B, C, D, E]
{A} → {B}

CRICOS Provider No: 00025B 2


{C} → {D, E}
{A, D, E} → {C}
{B, C} → {A}

{A, C}, {A, D, E} and {B, C} are all candidate keys

{A, D, E} → {C} and {B, C} → {A} are lost

Final answer:
R1[A, B] {A} → {B}
R3[C, D, E] {C} → {D, E}
R4[A, C] No non-trivial FD

Notice that this is the same solution as A.2, think why this is the case despite
A.4 having double the number of initials FDs. What is lost?

SEE NEXT PAGE FOR SECTION B

CRICOS Provider No: 00025B 3


Section B: 3NF Decomposition
Normalise the following relations into 3NF using the “bottom-up” approach, that is
complete synthesis using minimal cover.
B.1 R [A, B, C, D, E, F, G, H]
{A, B} à {C}
{C, D} à {E}
{D} à {F, G}

ABDH+ = {ABDHCEFG} ({A, B, D, H} is the candidate key)


Prime attributes: A, B, D, H

Find Minimal Cover:

Step 1: RHS Step 2: LHS Step 3: Delete


Simplification Simplification Redundant FDs
{A, B} à {C} {A, B} à {C} {A, B} à {C}
{C, D} à {E} {C, D} à {E} {C, D} à {E}
{D} à {F} {D} à {F} {D} à {F}
{D} à {G} {D} à {G} {D} à {G}

Simplified Set of FDs:


(No change to original set)
{A, B} à {C}
{C, D} à {E}
{D} à {F, G}

Synthesis:

R1[A, B, C] {A, B} à {C}


R2[C, D, E] {C, D} à {E}
R3[D, F, G] {D} à {F, G}
R4[A, B, D, H] No non-trivial FD

R1 - R4 are in 3NF

CRICOS Provider No: 00025B 4


B.2 R [A, B, C, D, E, F]
{A, B} à {C}
{C} à {D, E}

ABF+ = ABCDEF ({A, B, F} is the candidate key)


Prime attributes: A, B, F

Find Minimal Cover:


Step 1: RHS Step 2: LHS Step 3: Delete
Simplification Simplification Redundant FDs
{A, B} à {C} {A, B} à {C} {A, B} à {C}
{C} à {D} {C} à {D} {C} à {D}
{C} à {E} {C} à {E} {C} à {E}

Simplified Set of FDs:


(No change to original set)
{A, B} à {C}
{C} à {D, E}

Synthesis:

R1[A, B, C] {A, B} à C
R2[C, D, E] C à {D, E}
R3[A, B, F] No non-trivial FD

R1, R2 and R3 are in 3NF

CRICOS Provider No: 00025B 5


B.3 R [A, B, C, D, E]
{A} à {D, E}
{D} à {A}
{B} à {C}
{B, C} à {A, D}
{E, A} à {D}

B+ = ABCDE ({B} is the candidate key)


Prime attributes: B

Find Minimal Cover:


Step 1: RHS Step 2: LHS Step 3: Delete
simplification simplification redundant FDs
{A} à {D} {A à D} {A} à {D}
{A} à {E} {A à E} {A} à {E}
{B, C} à {A} {B à A} {B} à {A}
{B, C} à {D} {B à D} {B} à {D}
{D} à {A} {D à A} {D} à {A}
{E, A} à {D} {A à D} {A} à {D}
{B} à {C} {B à C} {B} à {C}

Simplified Set of FDs:


{A} à {D, E}
{B} à {A, C}
{D} à {A}

Synthesis:

R1[A, D, E] {A} à {D, E}, {D} à {A}


R2[B, A, C] {B} à {A, C}

R1 - R3 are in 3NF

CRICOS Provider No: 00025B 6


B.4 R [A, B, C, D, E, F]
{A} à {B, C, D, E, F}
{B, C} à {A}
{D, E} à {B}
{C} à {D}

{A}, {B, C} and {C, E} are all candidate keys


Prime attributes: A, B, C, E

Find Minimal Cover:


Step 1: RHS Step 2: LHS Step 3: Delete Redundant FDs
Simplification Simplification
{A} à {B} {A} à {B} {A} à {B} [{A} à {D}, {A} à {E}, {D, E} à {B}]
{A} à {C} {A} à {C} {A} à {C}
{A} à {D} {A} à {D} {A} à {D} [{A} à {C} and {C} à {D}]
{A} à {E} {A} à {E} {A} à {E}
{A} à {F} {A} à {F} {A} à {F}
{B, C} à {A} {B, C} à {A} {B, C} à {A}
{D, E} à {B} {D, E} à {B} {D, E} à {B}
{C} à {D} {C} à {D} {C} à {D}

Simplified Set of FDs:


{A} à {C, E, F}
{B, C} à {A}
{D, E} à {B}
{C} à {D}

Synthesis:

R1[A, C, E, F] {A} à {C, E, F}


R2[B, C, A] {B, C} à {A}
R3[D, E, B] {D, E} à {B}
R4[C, D] {C} à {D}

R1 - R4 are in 3NF

CRICOS Provider No: 00025B 7

You might also like