0% found this document useful (0 votes)
12 views14 pages

DBMS 5

Vgg

Uploaded by

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

DBMS 5

Vgg

Uploaded by

ttap44832
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
check Equivalence of Functional Defencleney : ya a ee a ee al aj (Ry RS - Exansple-t R (acden) Fi Age en op AD * ES an E> i Fs 4c (A)t = acd (A)* AcD ee (age = ACD Cr)t~ DEH Bees neyt =) VED EH=G te) een drag Fronplen: R(PaRS) XD Pe Ys PIQR QAR R36 Ros pease xe lapel IY cx fs x) x= oS Uae aby | [P)*-rars - Qt. a * . | rR | re rake ene Bent R (Vx YZ) FL Rae Gi: WAaxT” Wx v ZW ~ Ger Gs Ay BE BA peg S-7A ash in Zany 4 ABC i wre ABC! ote eo! Zov * eetiauuae | CateoABS (aye xX yt = ney Or ree (oo! WY | @te VAYEX se F=Gq (ms) ae xeer So, GEE Ons), «Two different sets of functional dependencies for a given relation may or may not be equivalent. + IfF and G are the two sets of functional dependencies, then following 3 cases are possible- Case-01: F covers G (F 2 G) Case-02: G covers F (G 2 F) Case-03: Both F and G cover each other (F = G) Case-01: Determ! Whether F Covers G- Following steps are followed to determine whether F covers G or not- Step-O1: * Take the functional dependencies of set G into consideration. «For each functional dependency X — Y, find the closure of X using the functional dependencies of set G Step-02: «Take the functional dependencies of set G into consideration. «For each functional dependency X — Y, find the closure of X using the functional dependencies of set F. Step-03: + Compare the results of Step-01 and Step-02. «Ifthe functional dependencies of set F has determined all those attributes that were determined by the functional dependencies of set G, then it means F covers G. + Thus, we conclude F covers G (F 2 G) otherwise not. Case-02: Determining Whether G Covers F- Following steps are followed to determine whether G covers F or not- Step-01: + Take the functional dependencies of set F into consideration. «For each functional dependency X — Y, find the closure of X using the functional dependencies of set F. Prepared by SKS. CSE Page 5 of 13 Step-02: © Take the functional dependencies of set F into consideration. «For each functional dependency X — Y, find the closure of X using the functional dependencies of set G. © Compare the results of Step-O1 and Step-02. «Ifthe functional dependencies of set G has determined all those attributes that were determined by the functional dependencies of set F, then it means G covers F. «Thus, we conclude G covers F (G 2 F) otherwise not. Case-03: Determining Whether Both F and G Cover Each Other- + IfF covers G and G covers F, then both F and G cover each other. «Thus, if both the above cases hold true, we conclude both F and G cover each other (F = SG), PRACTICE PROBLEM BASED ON EQUIVALENCE OF FUNCTIONAL DEPENDENCIES- Problem- ‘Arelation R (A, C , D, E, H) is having two functional dependencies sets F and Gas shown- Set F- Asc ACD ESAD EoH Set A>CD EsAH Which of the following holds true? (a)G2F (B)F2G ()F=G (D) All of the above Prepared by SKS. CSE Page 6 of 13 “* Solution- Determining whether F covers G- Step-01: + (Ay={A,C,D} / | closure of left side of A CD using set G + (=(A,C,D,E,H} // closure of left side of E+ AH using set G Step-02: + (yr={A,C,D} // closure of left side of A> CD using set F + (BP ={A,C,D,E,H} // closure of left side of E+ AH using set F Step-03: Comparing the results of Step-01 and ‘Step-02, we find- + Functional dependencies of set F can determine all the attributes which have been determined by the functional dependencies of set G + Thus, we conclude F covers G i.e. F 2G. Determining whether G covers F- Step-01: + yrn{A,C,D) /| closure of left side of A > C using set F * (acyr={A,C,D) // closure of left side of AC + D using set F + ((A,C,D,E,H} // closure of left side of EAD and E ~ H using set F Step-02: + (ayr={A,C,D) // closure of left side of A + C using set G * acyr={A,C,D} // closure of left side of AC — D using set G + ()=(A,C,D,E,H) // closure of let side of E + AD and E + H using set G Step Comparing the results of Step-01 and Step-02, we find- + Functional dependencies of set G can determine all the attributes which have been determined by the functional dependencies of set F. + Thus, we conclude G covers Fi.e. G2 F. Prepared by SKS. CSE Page 7 of 13 Determining whether both F and G cover each other- «From Step-01, we conclude F covers G. + From Step-02, we conclude G covers F, + Thus, we conclude both F and G cover each other i.e. F = G. ‘Thus, Option (D) is correct. Canonical Cover in DBMS- In DBMS, * Acanonical cover is a simplified and reduced version of the given set of functional dependencies. + Since it is a reduced version, it is also called as Irreducible set. Characteristics- * Canonical cover is free from all the extraneous functional dependencies. «The closure of canonical cover is same as that of the given set of functional dependencies. * Canonical cover is not unique and may be more than one for a given set of functional dependencies. Need- © Working with the set containing extraneous functional dependencies increases the computation time. «Therefore, the given set is reduced by eliminating the useless functional dependencies. «This reduces the computation time and working with the irreducible set becomes easier. Steps To Find Canonical Cover- Step-01: Write the given set of functional dependencies in such a way that each functional dependency contains exactly one attribute on its right side. Example: ‘The functional dependency X —+ YZ will be written as- X3Y XZ Prepared by SKS. CSE Page 8 of 13 Step-02: = Consider each functional dependency one by one from the set obtained in Step-O1 * Determine whether it is essential or non-essential. ‘To determine whether a functional dependency is essential or not, compute the closure of its left side- «Once by considering that the particular functional dependency is present in the set + Once by considering that the particular functional dependency is not present in the set Then following two cases are possible- Case-01: Result If results come out to be same, « Ttmeans that the presence or absence of that functional dependency does not create any difference. + Thus, it is non-essential. + Eliminate that functional dependency from the set. NOTE- « Bliminate the non-essential functional dependency from the set as soon as itis discovered. «Da mot consider it while checking the essentiality of other functional dependencies. Case-01: Results Come Out to be Different: If results come out to be different, «Tt means that the presence or absence of that functional dependency creates a difference, «Thus, it is essential. «Do not eliminate that functional dependency from the set. «Mark that functional dependency as essential. Step-03: «Consider the newly obtained set of functional dependencies after performing Step-02. Check if there is any functional dependency that contains more than one attribute on its left side. ‘Then following two cases are possible- Prepared by SKS. CSE Page 9 of 13 Case-01: No- * There exists no functional dependency containing more than one attribute on its left side * In this case, the set obtained in Step-02 is the canonical cover. Case-01: ¥ * There exists at least one fui nctional dependency containing more than one attribute on its left side. + In this case, consider all such functional dependencies one by one. * Check if their left side can be reduced. Use the following steps to perform a check- * Consider a functional dependency. * Compute the closure of all the possible subsets of the left side of that functional dependency. Ifany of the subsets produce the same closure result as produced by the entire left side, then replace the left side with that subset, After this step is complete, the set obtained is the canonical cover. PRACTICE PROBLEM BASED ON FINDING CANONICAL COVER. ‘The following functional dependencies hold true for the relational scheme R(W , X,Y ,Z) XW WZ — xy Y > WXZ Write the irreducible equivalent for this set of functional dependencies, lution. Step-01: Write all the functional dependencies such that each contains exactly one attribute on its right side- xXoW WZ3X WZ Yow Yox YZ Prepared by SKS. CSE Page 10 of 13 Step-02: Check the essentiality of each functional dependency one by one. For X — W: © Considering X > W, (X)*={X,W} © Ignoring X = W, (X)* ={X)} Now, + Clearly, the two results are different + Thus, we conclude that X —» W is essential and can not be eliminated. For WZ — X: * Considering WZ — X, (WZ)* ={W,X,Y,Z} + Ignoring WZ X, (W2)* =(W,X,¥,2} Now, + Clearly, the two results are same. + Thus, we conclude that WZ — X is non-essential and can be eliminated. Eliminating WZ — X, our set of functional dependencies reduces to- xX-+W wz7¥ Yow Yox You Now, we will consider this reduced set in further checks. For WZ — Y: + Considering WZ — Y, (WZ)"={W,X,¥,2Z} © Ignoring WZ — Y, (WZ) = {WZ} Now, + Clearly, the two results are different. 4 Thus, we conclude that WZ — Y is essential and cannot be eliminated. For ¥ > W: © Considering ¥ — W, (¥)' ={W,X,¥,Z} «Ignoring ¥ + W, (YJ ={W,X,¥,2Z} Prepared by SKS. CSE Page 11 of 13 Now, * Clearly, the two results are same. + Thus, we conclude that Y + W is non-essential and can be eliminated. Eliminating Y — W, our set of functional dependencies reduces to- XoW WZ Y Yox You For ¥~X: + Considering Y — x, (¥)*=(W,X,Y,Z)} + Ignoring ¥ > x, (¥)*={¥, Z} Now, + Clearly, the two results are different. * Thus, we conclude that Y — X is essential and can not be eliminated. For ¥ — Z; + Considering Y > Z, (Y={W,X,Y,Z} + Ignoring Y — Z, (Y)"={W,X,Y} Now, + Clearly, the two results are different. + Thus, we conclude that Y — Z is essential and can not be eliminated. From here, our essential functional dependencies are- Xow WZ>Y YX Yoz Prepared by SKS. CSE Page 12 of 13 Step-03: «Consider the functional dependencies having more than one attribute on their left side. + Check if their left side can be reduced. In our set, + Only WZ — ¥ contains more than one attribute on its left side. + Considering WZ — Y, (WZ)'={W,X,Y,2} Now, + Consider all the possible subsets of WZ. * Check if the closure result of any subset matches to the closure result of WZ. (wy = (W) (={Z} Clearly, «None of the subsets have the same closure result same as that of the entire left side. + Thus, we conclude that we cannot write WZ — ¥ as W > Yor Z > Y. + Thus, set of functional dependencies obtained in step-02 is the canonical cover. Finally, the canonical cover is- xXoW WZ—>Y Yox YoZ Canonical Cover Prepared by SKS. CSE Page 13 of 13 Tereducible Sef ef Functional Depeirdeney (also known as Canonical form) —_—— ane eT Ele) | Ae e r. Ve on Sabclurtant elem ent &xist or not 2 Ry IK yes, ther remove it YY Wxe Redundancy ig, possible nha 3.Cases - od feels: fal: o> = 7 “A gett ang case 2; A> On A side case! the Rint functional Aependen a Xf Z pagers 4 wedundancy oF fo congtruck Tt ¢ Tn order to yerctv rene F ics some he Canoe for Sheps: — Gleps: By Using decomposition Rule , sepanade all oe funehonal Aependency, neve — Sxarple , XA Remonta the ote cormpositin W x rule Cam be apply on se ~vight hand ip No} eed possible on le ‘t hand Yorn Std, fey ne BY x at Yo2 A579 aos} Afr Aecowpostion we can toy , veduncto As mot possible on vigthk band side, because pe brtan o decompose Lv prooduch'or . $5, 1 Phi a pe ae , “4 reclundameg only possi bk inthe p2: Cheen the entire xy ule 7S Vedumcomt or na} X35 AY (x) =e AZ X@* Again rnd (Kt bub Pais time WE shoulol not Considar 1 the X> p rut to check tts n A : necessity » ee is diffoont sof yey oe X31 7s Pmportank (H2)*. xHZY Pere BAZYX | game st So, eS ner ds vot pceessarg « We Can versive if - (N2)t = R2ZYx (A2)t- ne , pot same cf: $2 W239 {6 iepordant (tye HY? Cy)te Yxen. ep comet £0 mad jerportand + (ryt x2 eo 3-2 snot Some sa, $0, YO* 7S necessory yowts tr = exe Wyre xn newt Govre Sef, StL Y> 2 talso east * Addor tis, xaR h23Y To* ane + Gas SHB Amd Cheek vedumolomey on lef] side. After sepr, ne get — x9 W) n2> Y Yoox Y2 (weyt = ARYx (rr = AN, $0,275 Teportomt pecae only W + lan vot derive the Cntive W2Yx (2) = su. + here Iris also Important because of Somme Logic Afr Geb3, we get — XH Hzay > comoniical form YoxzZ Rewembor, Ie neck to follocd tye Lio of cheexing | Hf we sfonk ow process From batters “fo tops , fren The we cul} mag bL if forenk , Exconapl 2 Firat Canonical form - =e R( ABeD) Pecormpoce — A> B AB 7 C>B cB D- ABC DOA AC2D DOB Dec Ac 7D AwBo COR poAwm (ayeap | (cj Be [DE ABE ile Dee AeA (qyt- e (Qt Bde Ds ABCD) Dye ADE AC3D & (ag ACDB (AG)t= ACB Aor a Checkin§ Av’ CUB. the krdive woke We at ae Noo qhetK om left hand Ste 7 Qc)'= ACDB Ayre (ay AB 3 prot sarmnesek (coy cB go, ACYD ist ve dun hank Finally , |pCanonical beh on aminimized FD 4 pretlued bie seh

You might also like