0% found this document useful (0 votes)
10 views

Database Assignment 2

Uploaded by

mamadou.thiam
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 views

Database Assignment 2

Uploaded by

mamadou.thiam
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/ 3

ASSIGNMENT [X] ON DATABASES

Student’s Code Deadline

[Bamba GUEYE] [Date, Time]

February 14, 2024 2023-2024

Lecturer: Dr ATINDEHOU Meton-Meton

1 Solution of Exercise 5
Question 3: Add A → E to F and then determine the closure of {A, B}
under the new set F: New F = {AB → CD, CD → E, BE → A, A → E}.

Step 1: Set G := F and T1 := {A, B}.

Step 2: Search for functional dependencies X → Y in G such that X ⊂ T1 .

• AB → CD is found with {AB} ⊂ T1 . Update:


– T1+1 := T1 ∪ {C, D} = {A, B, C, D}
– G := G − {AB → CD} = {CD → E, BE → A, A → E}

Step 3: Search for functional dependencies X → Y in G such that X ⊂ T1 .

• CD → E is found with {D} ⊂ T1 . Update:


– T1+1 := T1 ∪ {E} = {A, B, C, D, E}
– G := G − {CD → E} = {BE → A, A → E}

Step 4: Search for functional dependencies X → Y in G such that X ⊂ T1 .

• BE → A is found with {B, E} ⊂ T1 . Update:


– T1+1 := T1 ∪ {A} = {A, B, E}
– G := G − {BE → A} = {A → E}

Step 5: Search for functional dependencies X → Y in G such that X ⊂ T1 .

• A → E is found with {A} ⊂ T1 . Update:


– T1+1 remains unchanged since E is already in T1 .
– G := G − {A → E} = {}

Step 6: As G is now empty, we are finished.

The closure of {A, B} under the new set F is {A, B, C, D, E}.

Po.Box 1418 Mbour-Thies, phone (+221) 33 956 7693, http://www.aims-senegal.org Page 1 of 3


2 Solution of Exercise 6
Question 1: To apply the reduction algorithm to the set of functional de-
pendencies F = {AB → CDE, CD → A, BE → A} , let’s follow the steps
described in the algorithm. Then, we’ll check if the dependency AB → CDE
is included in the obtained left-reduced cover.
Step 1: Set G := F .
Step 2: For each functional dependency in G, we execute the reduction
algorithm.
1. Test AB → CDE:
• Test A: find B + = {B}, CDE ⊈ A+ , so A is not auxiliary.
• Test B: find A+ = {A}, A ⊈ CDE, CDE ⊈ A+ , so B is not
auxiliary.
2. Test CD → A:

• Test C: find D+ = {D}, and A ⊈ D+ , so C is not auxiliary.


• Test D: find C + = {C}, A ⊈ C, CDE ⊈ A+ , so D is not auxiliary.

3. Test BE → A:
• Test E: B + = {B}, A ⊈ B + , so E is not auxiliary.
After completing the reduction algorithm, we obtained the following left-
reduced cover: G = F .
Step 3: Check if the dependency AB → CDE is included in the obtained
left-reduced cover.
Question 2: We find that the dependency AB → CDE is included in the
left-reduced cover, as it was not eliminated during the application of the
reduction algorithm.

3 Solution of Exercise 8
Let F = {ABC → DEF, F EG → A, DE → C} be a set of functional
dependencies on the relational schema R(A, B, C, D, E, F, G).
Question 1: Apply the left-reduction algorithm to F to obtain a left-
reduced cover.

Step 1: Set G := F .
Step 2: For each functional dependency in G, we execute the reduction
algorithm.

Po.Box 1418 Mbour-Thies, phone (+221) 33 956 7693, http://www.aims-senegal.org Page 2 of 3


1. Test ABC → DEF:

• Test A: find (BC)+ = {B, C}, DEF ⊈ (BC)+ , so A is not auxil-


iary.
• Test B: find (AC)+ = {A, C}, DEF ⊈ (AC)+ , so B is not auxil-
iary.
• Test C: find (AB)+ = {A, B}, DEF ⊈ (AB)+ , so C is not auxil-
iary.

2. Test FEG → A:

• Test F : find (EG)+ = {E, G}, A ⊈ (EG)+ , so F is not auxiliary.


• Test E: find (F G)+ = {F, G}, A ⊈ (F G)+ , so E is not auxiliary.
• Test G: find (F E)+ = {F, E}, A ⊈ (AB)+ , so C is not auxiliary.

3. Test DE → C:

• Test D: find E + = {E}, A ⊈ E + , so D is not auxiliary.


• Test E: find (D+ = {D}, C ⊈ D+ , so E is not auxiliary.

Question 2: We find that the dependency ABC → DEF is included


in the left-reduced cover.

Question 4: Apply the canonical cover expansion algorithm to the


obtained left-reduced cover to get the canonical cover for F.

• (ABC)+ = {A, B, C}, FEG ⊈ (ABC)+ and DE ⊈ (ABC)+


• (F EG)+ = {F, E, G}, ABC ⊈ (F EG)+ and DE ⊈ (F EG)+
• (DE)+ = {D, E}, ABC ⊈ (DE)+ and FEG ⊈ (DE)+
Therefore, the expanded canonical cover Fexpanded remains the
same as the original canonical cover Fc .
Fc = {ABC → D, ABC → E, ABC → F, F EG → A, DE → C}

Po.Box 1418 Mbour-Thies, phone (+221) 33 956 7693, http://www.aims-senegal.org Page 3 of 3

You might also like