0% found this document useful (0 votes)
28 views4 pages

NguyenVanPhongHE190611LAB2

The document discusses various aspects of database normalization, including finding keys, determining normal forms, and analyzing functional dependencies. It covers examples of relation schemes, minimal bases, and decompositions, highlighting whether they preserve dependencies and maintain lossless joins. The document concludes with a successful decomposition into BCNF that preserves dependencies and ensures a lossless join.

Uploaded by

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

NguyenVanPhongHE190611LAB2

The document discusses various aspects of database normalization, including finding keys, determining normal forms, and analyzing functional dependencies. It covers examples of relation schemes, minimal bases, and decompositions, highlighting whether they preserve dependencies and maintain lossless joins. The document concludes with a successful decomposition into BCNF that preserves dependencies and ensures a lossless join.

Uploaded by

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

1.

Consider the relation scheme with attributes S (store), D


(department), I (item), and M (manager), with functional dependencies SI
-> D and SD -> M.

a. Find all keys for SDIM.

b. Show that SDIM is in second normal form but not third normal
form.

a. SI -> D, SD -> M => SI -> M, also SI -> D => SI is the only key

b. As D is the only non-prime attribute in the relation, and we have the


functional dependency SI -> D =>> no partial dependencies in the
relation =>> the relation is 2NF
because of the transitive dependency SD→M, where M depends on a
non-prime attribute D, violating the 3NF condition => the relation is
not 3NF

2. Consider the relation scheme with attributes CITY, ST, and ZIP,
which we here abbreviate
C, S, and Z. We observed the dependencies CS->Z and Z->C. The
decomposition of the relation scheme CSZ into SZ and CZ has a lossless join.
Does this decomposition preserve dependencies?

The decomposition into R1(SZ)R_1(SZ)R1(SZ) and R2(CZ)R_2(CZ)R2


(CZ) is not dependency-preserving:

● CS→Z is not preserved because C and S are in different relations.


● Z→C is preserved in R2(CZ)
● Thus, the decomposition does not preserve all dependencies.

3. Let F = {AB C, A D, BD C}.

a. Find a minimal basis for F.


b. Give a 3NF, dependency-preserving decomposition of ABCD into
only two schemes (with respect to the set of functional
dependencies F).

c. What are the projected dependencies for each of your schemes?

D. Does your answer to (b) have a lossless join? If not, how could you
modify the database scheme to have a lossless join and still preserve
dependencies?

a.
A→D => AB -> BD.

BD→C => AB -> C

Thus, the minimal basis for F is {A→D,BD→C};

b. Decompose into two schemas:


1. R1(ABD)
2. R2(BC)
Projected Dependencies:

● R1(ABD)retains A→Dand part of BD→C


● R2(BC) retains AB→C and part of BD→C

c.
This decomposition does not have a lossless join because R1(ABD) and
R2(BC) do not share a key.

To ensure a lossless join while still preserving dependencies, we could add a


relation R3(ABC), ensuring that both dependencies and lossless join properties
are satisfied.

4. Let F = {AB-> C, A-> B}.

a. Find a minimal cover (or minimal basis) for F.


b. When (a) was given on an exam at a large western university, more
than half the class answered G = {A B, B C}. Show that answer is
wrong by giving a relation that satisfies F but violates G.
a.
If we remove B, A→C is not implied by F, so B is not extraneous.
Hence, AB→C remains unchanged.

The minimal cover for F is {AB→C,A→B}

b.
Consider the relation

A B C

1 2 3

1 2 4

This relation satisfies FFF:

○ A→B holds because for all rows, if A=1, then B=2


○ AB→C holds because (A,B)=(1,2) determines both values of C(3
and 4).
● But this relation violates G:
○ B→C does not hold because when B=2, C can be either 3 or 4.

Therefore, G={A→B,B→C} is incorrect, as it does not capture the functional


dependencies in F.

5. Suppose we are given relation scheme ABCD with functional


dependencies

{A B, B C, A D, D C}. Let r be the decomposition (AB, AC, BD).

a. Find the projected dependencies for each of the relation schemes of


r.

b. Does r preserve the given dependencies?


a.Projected Dependencies
For the decomposition r={(AB),(AC),(BD)}

1. ABABAB: Preserves A→B


2. ACACAC: Implies A→C
3. BDBDBD: Preserves A→D

b.Dependency Preservation
The decomposition does not preserve all dependencies:

● A→B and A→C are preserved.


● B→C and D→C are not preserved.

6. Consider the relation scheme ABCD with dependencies


F={A B, B C, D B]

We wish to find a lossless-join decomposition into BCNF.

1. Decompose based on A→B:


○ R1(A,B) (BCNF: A is a superkey)
○ R2(A,C,D) (needs further decomposition)
2. Decompose R2(A,C,D) based on D→B:
○ R3(D,B) (BCNF: D is a superkey)
○ R4(A,C,D) (BCNF)

Final Relations

● R1(A,B)
● R3(D,B)
● R4(A,C,D)Lossless Join

The decomposition is lossless because joining R1, R3, and R4 reconstructs


R(ABCD)

The decomposition is in BCNF and preserves dependencies.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy