0% found this document useful (0 votes)
18 views42 pages

UNIT III - Functional Dependency

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

UNIT III - Functional Dependency

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

Functional dependency

Functional dependency
Inference rule
1.Compute the closure of the following set of
functional dependencies for a Relation scheme

R(A,B,C,D,E) F={A->BC,CD->E,B->D,E->A)

Consider F as follows
A->BC
CD->E
B->D
E->A
2.Compute the closure of the following set of functional
dependencies for a Relation scheme R(A,B,C,D,E) F={A-
>BC,CD->E,B->D,E->A) and Find the candidate key.

Solve :
2. R(A,B,C,D,E,F) F={ AB->C, C->A , BC->D, ACD->B,
BE->C,
CE->FA , CF->BD, D->EF}
Canonical cover or
Minimal cover
Definition : An attribute of a functional dependency is
said to be extraneous if we can remove it without
changing the closure of the set of functional
dependencies.
Algorithm : Minimal Cover or Canonical Cover

Step 1: Write the functional dependencies in such a way that


it contains right side one attribute

Step 2: Find the Closure of the attributes

Step 3: Check whether any left-side attributes can be


reduced
3. F = {x->w, wz->xy , y->wxz}

Solve:

4. Consider the following functional dependencies


over the attribute set R(ABCDE) for finding minimal
cover FD = {A->C,AC->D,B->ADE}
Anomalies
Redundant storage
Update anomalies
Insertion anomalies
Deletion anomalies
Relatonal
Decomposition
Solve :

5. Consider the following relation R(A,B,C,D)and FDs A-


>BC, is the decomposition of R into R1(A,B,C),
R2(A,D). Check if the decomposition is lossless join or
not.

6. ConsiderthefollowingrelationR(A,B,C,D,E,F)and FDs
A->BC,C->A,D->E, F->A, E->D is the decomposition
of R into R1(A,C,D), R2(B,C,D), and R3(E,F,D). Check
Dependency Preservation
7. Let relation R(A,B,C,D) be a relational schema with
following functional dependencies{A->B,B->C,C->D,andD-
>B}. The decomposition of R into(A,B),(B,C) and (B,D).
Check whether this decomposition is dependency preserving
or not.

8. Consider the relation R (A,B,C) for functional dependency


set{A->B and B -> C} which is decomposed into two
relations R1 = (A, C) and R2 = (B, C). Then check if this
decomposition dependency preserving or not.
Normalization
 Example:
Name Roll No Branch Language known
Sai 21 CSE Telugu
Sai 21 CSE English
Shiva 22 HTML English

Shiva 22 HTML Hindi


Raju 24 DS English

Raju 24 DS Hindi
TABLE 1 TABLE 2

Name Roll No Branch Roll No Language known

21 Telugu
Sai 21 CSE
21 English

22 English
Shiva 22 HTML
22 Hindi

Raju 24 DS 24 English

24 Hindi
Name Roll No Branch
Sai 21 CSE
Shiva 22 HTML
Raju 23 DS
Suresh 24 ECE

Branch Fees

Name -> branch -> Fees CSE 30,000

HTML 0,000

DS 10,000

ECE 5000
TABLE: STUDENT TABLE 1: STUDENT
Roll No Name Branch_id Branch Roll No Name

21 Sai 121 CSE 21 Sai

22 Shiva
22 Shiva 122 HTML
23 Raju
23 Raju 123 DS
24 Suresh
24 Suresh 121 CSE

TABLE 2: DEP

{ Roll no -> name} {Branch_id -> Branch} Branch_id Branch

121 CSE
Super key not a super key 122 HTML

123 DS

You might also like