Sie sind auf Seite 1von 7

ASSIGNMENT NORMALIZATION

MUHAMMAD FARHAN SALEEM


L1F07BSCS2007

1. Prove or disprove the following inference rules:

a. {W->Y,X->Z}|= {WX->Y}

w->Y (GIVEN)
w->YX (AUGMENTATION ON 1)
W->Y (DECOMPOSITION)

b. {X->Y}and Z is a subset of Y |={Y->Z}

X->Y (Given)
Y->Z (REFLEXIVE ON Z (SUBSET OF Y))

c. {X->Y,X->W,WY->Z} |={X->Z}

WY->Z (GIVEN)
X->W (GIVEN)
X->Y (GIVEN)
WX->Z (IR6 ON 1)
X->Z

d. {XY->Z,Y->Z}|={XW->Z}

DISPROVE

e. {X->Z,Y->Z}|={X->Y}

DISPROVE

f. {X->Y,XY->Z}|= {X->Z}

X->Y (GIVEN)
XY->Z (GIVEN)
XX->Z (IR6 ON2)
X-Z (XX=X)

g. {X->Y,Z->W}|= {XZ->YW}

X->Y (GIVEN)
Z->W (GIVEN)
XZ->XW (IR2 ON3)
XZ->YW (IR6 ON3)

h. {XY->Z,Z->X} |= {Z->Y}

XY->Z (GIVEN)
Z->X (GIVEN)
XY->X (IR3 ON 1 AND 2)
XY->XY (IR2 ON 3)
Z->XY (IR6 ON 4)
Z->Y (IR4 ON 5)

i. {X->Y,Y->Z} |= {X->YZ}

X->Y (GIVEN)
Y->Z (GIVEN)
X->Z (IR3 ON 1 AND 2)
X->YZ (IR5 ON 3)

j. {XY->Z,Z->W}|={X->W}

DISPROVE

2. Consider the following two sets of functional dependencies check whether they
are equivalent or not:

F = {A->C, AC->D, E->AD, E->H}


G = {A->CD, E->AH}

SOLUTION:

PROOF (A->CD) FROM ‘F’


A->C (GIVEN)
AC->D (GIVEN)
AA->D (IR6 ON 2)
A->D (AA=A)
A->CD (IR6 ON 1 AND 4)

PROOF (E->AH) FROM ‘F’


E->AD (GIVEN)
E->H (GIVEN)
E->A (IR4 ON 1)
EH->AH (IR3 ON 3)
EE->AH (IR6 ON 4)
E->AH (EE=E)

SET ‘F’ COVERS ‘G’


PROOF (A->C) FROM ‘G’
A->CD (GIVEN)
A->C (IR4 ON 1)

PROOF (AC->D) FROM ‘G’


A->CD (GIVEN)
AC->CD (IR2 ON 1)
AC->D (IR4 ON 2)

PROOF (E->AD) FROM ‘G’


E->AH (GIVEN)
A->CD (GIVEN)
A->C (IR4 ON 2)
E->A (IR4 ON 1)
E-CD (IR3 ON 2 AND 4)
E->AD (IR6 ON 5)

PROOF (E->H) FROM ‘G’


E->AH (GIVEN)
E->H (IR4 ON 1)

SET ‘G’ COVERS ‘F’


SO ‘F’ AND ‘G’ ARE EQUIVALENT

3. Considering the model EMP_DEPT schema in Fig 10.3a and the following set G
of functional dependencies on EMP_DEPT:
G{SSN-> {Ename,Bdate,Address,DNumber} , DNumber->{Dname,Dmgrssn}}.
Calculate the closures {SSN}+ and {DNumber}+ with respect to G.

CLOSURE OF SSN
{SSN}+={SSN,Ename,Bdate,Address,DNumber,DName,Dmgr
ssn}

CLOSURE OF DNUMBER
{DNumber}+={DNumber,DName,Dmgrssn}

4. Is the set of dependencies G is minimal? If not, try to find a minimal set equivalent
to G. Prove that it is equivalent to G.

LEFT 4 U

5. What update anomalies occur in the Emp_Proj and Emp_Dept relations of Fig.
10.3 and Fig.10.4?

LEFT 4 U
6. Prove that any relation schema with two attributes is in BCNF

R(A,B)
1. A attribute is Primary key and B is candidate
2. if A->B
B->A
Then it is in BCNF

7. Consider the Universal Relation R={A,B,C,D,E,F,G,H,I,H} Decompose R into


2NF and 3NF relations for the following and set of dependencies:

a. F1={{A,B}->{C},{B,D}->{E,F},{A,D}->{G,H},{A}->{I},{H}->{I}}

b. F2={{A,B}->{C},{A}->{E,D},{B}->{F},{F}->{G,H},{D}->{I,J}}

Closure Set
A

{A,B}+={A,B,C,I} PD1
{B,D}+={B,D,E,F} PD2
{A,D}+={A,D,G,H} PD3

R1=PD1, R2=PD2, R3=PD3, R4=Remaining

R1 (A,B,C,I) 2NF,3NF
R2 (B,D,E,F) 2NF,3NF
R3 (A,D,G,H,T) 2NF
R4 (A,B,D) 2NF,3NF

R1 further breaks into R11 and R12


R11(A,I)
R12(A,B,C)

R3 further breaks into R31 and R32


R31 (H,I)
R32 (A,D,C,H)

Closure Set

R1 (A,D,E) 2NF
R2 (B,F) 2NF
R3 (A,B,C,G,H,I,J) 2NF,3NF
R1 further breaks into R11 and R12
R11 (D,I,J)
R12 (A,E,D)

R2 further breaks into R21 and R22


R21 (F,G,H)
R22 (B,F)

8. Consider a relation R(A,B,C,D,E) with the following dependencies:

AB->C, CD->E, DE->B

Is AB a candidate key? If not, is ABD? Explain.

Closure Set
{AB}+={A,B,C}
{CD}+={C,D,E,B}
{DE}+={D,E,B}

AB is not a Candidate Key neither ABD because both of them


not determine all attributes, so they are not candidate.

Q9- Consider the relation schedule (stdid, classno, stdname, stdmajor, classtime,
room, instructor) and the set
F={ stdid{stdname, stdmajor}, classno{classtime, room, instructor } }

a. What is the key often this relation? Prove it.


b. What is the highest normal form of this relation? Give Reason.
c. What type of anomalies does this relation have?
d. Transfer this relation to its next higher form.

A. Closure Set
{stdId}+={stdName,stdMajor}
{classNo}+={classTime,room,instructor}

Key is {StdId,ClassNo}

B. 1NF because PFD Exist.

C. All (insert,update,delete) anomalies.

D. Removing PFD
R Breaks into R1(PFD1),R2(PFD2),R3(Remaining)
R1 (stdid,stdname,stdmajor)
R2 (classNo,room,instructor)
R3 (stdid,classno)
Q 10. Consider the relation ProgrammerTask (prog-id, programmer-package-id,
Programming-package-name, total-hours-worked-on-package) and the set
F= { programming-package-id programming-package-name,
{progid, Programming-package-id}  total-hours-worked-on-package }
a. What is the key of this relation Prove it.
b. What is the highest normal form of this relation? Give reason.
c. Transfer this relation to its next higher form.

A. Closure set
{progid-programming –package-id}+={progid,programming
– package-id,total-hours-worksed –on-package}
{ programming –package-id }+={ programming –package-id
, package-name}

Key is { prog-id, programming –package-id }

B. 1NF Because PFD exist.

C. Transferring from 1NF to 2NF


R breaks into R1(PD1),R2(Remaining)
R1 (programming –package-id, package-name)
R2 (prog-id, programming –package-id, total-hours-on-
package)

Q11. Consider the relation SALES(tranno, itemno, price, qty, seller, sregion) and the
set F= { {tranno,itemno}  qty, itemnoprice, trnsnoseller, sellersregion}
a. What is the KEY of this relation? Prove it.
b. What is the highest normal form of this relation? Give reason.
c. If it is not in 3NF find a decomposition that is lossless and dependency
preserving.

A.Closure Set
{tranno,itemno}+={tranno,itemno,qty,price,seller,sregion}
{tranno}+={tranno,seller,sregion}
{itemno}+={itemno,sregion}
{seller}+={sregion}

Key is {tranno,itemno}

B. 1NF Because PFD exist

C. Decomposing
R into R1,R2 and R3
R1 (tran#,seller,sregion) 2NF
R2 (item#,price) 3NF
Decompse R1 into R11(T.D) and R12(Remaining)
R11 (Seller,Sregion) 3NF
R12 (tran#,seller) 3NF
Now it is Loss Less and Perserved.

Q 12. Consider the relation TECH (student, course, instructor) and the set
F= { {student,course}  instructor, instructorcourse }

a. What is the key of this relation? Prove it.


b. What is the highest normal of this relation? Give reason.
c. If its is not in BCNF find a decomposition that is lossless.

A. Closure Set
{student,course}+={student,course,instructor}
{instructor}+={instructor,course}
Key is {student,course}

B. 3NF because T.D (Transitive Dependency) exist.

C. Removing Transitive Dependency


R Decompose into R1(T.D) and R2(Remaining)
R1 (course, instructor )
R2 (student,instructor)

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006

Das könnte Ihnen auch gefallen