You are on page 1of 29
on Meret E-R Starts for Entity Relationship - soe Jet describes tne overall logical secs FG database - Baste termimciegy eet An entity iS a thing or object that ts degrquisrebe rom ait ether objects « E-g- Person Envbjcct:§ Aa cubis @* cot of entities % He Same type Enak Share the Same prrepenttes ox attr2butes , E-g- The set all persons Loko ave CUStOTORTS, ata given bok ean be depooed aS enuty & customet. Teates . An entity tS nrepresented by a 6 of abestt Atertoube !- fn attribute is a descriptive property possessed Cee by each member F entity Set . Atty?butes can be classifted as |. Sienple atty2bute Q. Composite attrtbuke Simple attribute : - Aw attribute which carmot be divided iLO Sub paves 16 Knowo as scope attribute. Eg. cCustemer_id Composite attbute:- An attytbute Lohich can be divided ento subparts 1S know? as Composite attry?bute- E.g- customer - name of tN first mame aniddle_ initial lastname. Attxébutes can algo be classefied into 1- Stogle -vatued attribute 2. Muttivatued attri? buta Sioge -valued attribute es + An attribute Which posses a single value for o particulary entity is Known 45 single-Valve oo ee ateritule . muiee vated attribute —— promo nUrnst Devtved attribute -- fin attvibule yohese value an be dertved from the Vall putes kerowo uo of ones ued ad peseved Attrcpute - E.g- Customer _a cucrentdole custo — meV_oge = customer — CoB (rep = Dale of Bivth +) Relation ship :- A relationship tS a agecctatton ANHOMY Several entities - Relationship Set :- A ralakionship set tS a Set Of aattorsnps “Of the Same type - Mappiog Cordimatities ( Cardtnaltty vats) :- Tt express the anurmber of entieies to which associated Via a welasionsbip Sek . another entity Can be For a binary xelotionstip Set R betwoan ent 6 A ard B, the mapptg cardinality mustbe one & tHe foiovwarg + a One-to-One x one Abo THY ~*~ Many ~bo -ANe 3 Metry-bo mn t! One ; Me -to-one :- An entity to A & associated Latth atinst —— one entity in B ard an entity in BS Associated With atwnost One onttty mA. & one-to-~mary t= Am entity in A to ascecfabecl “thh ore entities inB. An entity asceciatect botkh abies: Zero or in B can be A ene entity A. 8 An entiby in A is associated with —_— Abmost ene entity in B- An entity IN B Coen bo assocfatec| Wit Zero or meve ences in A. He Mon YY ~ to -rnany :~ Re emany := An entiby t A is associated Wen 2e°O OF more entities in B and an entity B is asenciabod With Zafo or were ENHELCS in aA. Notations Used tm E-R Diagransé ee ete or ee polled dae Emtity Sets 2) —> Rectongle — CD _—> Ellipse — UN = petamend — \/ Aterepute, Relationshup sot times: atibutes to Le oe emtiby ets ard en Gls ko rojattonsrp Sets . ES —— > double = —— Murezvaiued abartbubog eltipse Dashed ellipse — Derived abeestbuces —_ -SopREayDS ferrep Peo Total parrkict pare welateenehtp 2k - Double vectargie — Weare antety SAS f § Of am entity 194 peneramnus/ sesedusas ‘ aidans aan woGboop da CY Ce (em > Deuble wes — —_ =e) fon2e2- a1pe2ee Joan numbey F Geom ou Gomeirt) “ap (ompioreye_- conn Nieto | — Cravenent Il Lernploe PP). oxy berrens’ = ( exenprvar-id, \oah-5utTe=* D =( eugrorrer 04 ) accoune number ) deposttot cule toner = (austere ET aed, roanget — Wosve_fot = ( wotet 2roploy erpioyee Xt) payenent = ( lean NUMe payment urbe , payment date ; payne oyne. ) accoune = (account nunibet , coecrogt ade ) ee sy Caccoune ductor | vate coreéunt J govirgs— Checker account meee E-R featuras a ® Spoctateratton * Generatreatton A Attribute Tenewtane: %* Aggregation Specialtzation :- Tk %& the reeult OF baking a subset a higher-level entity cet to form a loves entity set Generalization: 2b is the result Eating 1° unten of ~level enti by woo or more desjott lower SekS tO produce a higher-level anutty at . Attrtbube Inherttane@ :— the attebutes oF the neg herteve | gaseous entity seks are said tobe tphexitec| t by the lower-level anetty HS Agg xegatton * - Tk tS am abstrachon tn which velakionship oS SekS along with inetr associated entty Sets ave treated ab higher ave! an ttty BOS Are] COM parcttapale ty rojcrtronTyy , Spectattzatton and Generaliziton - oh cease) —— _ Kaen) CO) C02 eon-t — a eh eens a city, > | Margot Aggregate? ~ how Norma. ton, ee ot elimminatOg Vedund te ancy a eee eretoren wm 4 re SE Netmat Form ( NE) Av 4 lation go Rw m@ Foret C S >) tf the domains of ot qevestee of Rk Normal For A dorain 2 qtermnte elem domain ave comside: bo be eearvcetble UTES - read aat teres Form (ane) :~ A velation schewa R te tn second Nowra For CANED t cach attrtbulo A th R recto Oe of the flrorry cxitevia : 1. It appears ina comditdate Hey Q- Tbis mot partially deperdent on a comdidole tay Third Nox mal Form ( 3NF):- A vera sehewo R66 im Therd Niormat Form (ANF) with respect 2 SEF of fumettomotclepen- dencies if, for o puncttonal dependencies in FT ; xe XOR ELE eh tre fourm & 9 PNP ee oe Gos ot One ©} the followlng polde: nen ~_ ‘ ALO! * x36 fo 4 fatytal fue \ deope lerey % a io asuperkey for R Cs * Each atribute A in e-% 'S contamned un a Camdidale hay fork. Boyce Cede Novmal Keren (BENF):~ —_—_— A velatton echema R && tm BONE with veSpect +0 a set F of fumetional deperdemies t, for an functional dependercies tm et gp tre PER, ahteagt one G +> form X38, Where «EF OK folilorering bors: % ob 3e te a tial punctrdnal dapendgney - Ke XK f6 a Super OY for genera. R, Fourth Normal Form ( ANEY- ; A elation schema R te tn Fourth Normal For CA NE) with respect to a set D Of functional cand wmmititvalued deperclencies if, tor all mutttvauad depenclenwos im pt of tne foro) eas F pWhave XR and @LR, atleast one of HO foliovonng beds . % & 27 % a trivtal anuitivalued deperdery, : * “tsa Supesrey jor eporna © Fumctional Dependency : - Consider A elation Schema Ram tek «eR add BCR. The functional dependency %> B hoids on Sterna Re, im amy legal relation +(R), for at patre Of Luples t,and £5 im ¥ Such Eat ef] = tele], is also the case Enat «CPJ Ce] . Supplter $No—> Supplier No Sname 3 Supplier NE Setty Supplier tky SNo ——> SName The above notation can be read a6 Supplte No functionally determines Supplies Nene | ov Suppice Name is functionally depandant oD SUpBESNo | Uses |. To test welakions b> S62 Whethes they ave legal UmMey a given set Of functional depenc|antigg , Q: To Spectty COPEEXOEOKES OT the Sot G legal renter Trivial Functional Deperderty * ~ is trivial tg PO w- E-g- { sno, Satame | —> sno of — - Rex Functional dependencies ave also Kon ag equality — generating dependenctes Muttivatued Dependency Let R be a sselatton Schema ond let CR ard BOR: The mutivalued depardency o —3>F bods &> R ik, tm any tegal relation “(RY , for all patrs RES fpard tp in ¥ een enot £ fe) =e Us] | ee east tuples ta and ty & v Such trot aif) = to 00) = tafe = [8] e,CP1 = fF] tL PJ} = bah) t,[e-x-P] = +, [e-0-P] Egpe-a-P J = [et Pp : | ra @ | p-«-P “a b 4 i | oy by | | +s ay b eS | tq ay by a e9- Subject —>> Teacher . xtvéal Mutktvatued Dependency Se annie d deperdeny of >>P ts trsvvial A ceouletvalle iu po or aupeR, oan Dependency A join dependency (2 © constraint which opacities that the relation concernael & & jotn of specte ruses Of projecktons Decomposition of a Relattoo toh The process of reareng U7 Ce divéding sirgle Yelation tnto Ewo or Me Sub relations cated oS decornpesition . Types of Decomposition Decomposition can be clacsiféed &NbO tuo HPSS. I. Lossless Join Decompostbtto Q- Lossy Jotn Decomnpasttron Lossless Jotn Decommpesi —_—— Comeider that a relator R te devicled tnto R,,Ro --- Ran Sub relatos ° of the xojatten (tS said to be tne Sub sojatrons Yteld the game velatton Enat Was docoropooe - 1 The decomposttic® lossless When tre joe of Lossy Jot DecompcsittOn Consider a velation R which tS decomposed Ut Sub velations R,, Rs ~~” 7 The decomposition of the welation ts said to bo lossy When the join ot the gu velations does mot eld the same velatton that Was decommpesed . [eet a act en SR E-9- Consider the velotion R6A,B6) The relation Ris decomposed @nto Woo Sub wIAkTONs BCAcy and 22 (8,6) Te rele ~ ' \ 2 s 3 Ry Bo matural joro [rad ef the sub ots, Te we perform tne R, am Bo > we get \ Eg. St 9+ Consider the velatton R(A:8,¢) The xelatton R ts decomposed into two Sub valatkens RiCABY and BC BC) R,(AiB) Tf we perorm the matural jeto(oa ‘) of the Sutb YOKE grand &, We get RMR OR Properties of Decempositzen % Lossless Decomposthtor) * Dependency Presesvalnten. Lossless clecompecsition ensures %& No imfermation [s lest from the original TNAROD during decormposutton - %& When the subrerations Ae jetoed back, Bhe Same velatton ts ebtatnec| that Was decompose), Dependery preservation ensures se None of the funcional dependencies that botds oy ovigiesl elation are ISL . Skill hotd er Sat’Ssty Enoturctiora| the %& The Sub ee AAHONS deperdenctes Of the Ortgtral raratter @a to be wt SNE Zt} ard only Hit lo Splr.- A mmauen Bt = deperdlency exists . in ANE aod 0 joto =n (Eoye- Codd Normal Fown *) a tn BCNF with orpace A selattion erena ek © to a set F of functional dependerctes tf, For al! functionar dependenctes & Ft of the form % >p, ee ee ee forlercing heids : Ir X23 toa trivial functional deperdoty 2. & tsa Supeskey for seherm RB BenNiF Decomposition Algextinm yesult += 4 Rts dove .= false 5 corepute FT 4 whe (| ot done) do « u eure Eat tS if (there i9 a schema Rp wm Te im BNF ) 2? bagin nen Extvial functional cepettienty let 3p be? brat helds o> R, Such that xR ES mot HFT amd xab=o5 yosutt += (resutt-Re) v(Ri- PY (oP). end e\te done 1 = EU, BNE (third Nowmal form’) —— A velatton schema R tS i SNF With nespect to a Set F of functional deperaencies Uf, for alt furctrena | dependencies tw Et of the form xB, Wheve 1S F anc] Be R,aktteast ene of the forewing holds 1. X 3 to a trtveat functtonel dependenty - Q. x is a Supeskey for R 3. Gach ateripute A tn P-% (5 Conbatnec) tr? Camdidate Key tor R BNE Decompesttton Algerttom a SS let Fe be a canonical covert fa F; oo for cach functional dependency «3 f 0 Fe do Up nene of the Schemas Rj, 3 Hla --- FC ComEAWNS xp tL mone ef Ene Schenas (ye =1,2---Cconiars a Comdidate Ket tor eR Lnon eee Ri s= oe cardedale Kev for ES ord vreturn ( R,,R2 ~ a) @arorzayso ey foxcy G2 @agqsedusoo>P ‘sonuepucdeP lowcmyent WO oo sd ou tr oreua ance FF AUDHUNPOS MGI FOU INV axe APOIO nt PHS SNT SNES 62 6 peneneas Pee JING Gouy Buss arcu 92 INT oe dNog metre OF bee 2 eos woreP SSOP SST sonuopueds= PF joscorsnt We 20F sinv0> cag nrrosotd ‘Ane “0 Avampunpar soda 24 INE Gi pee ANT cq qerve KOON? INE purpusloP youeR men} SyL gnoa fe acu cooug Gaoys ssal St ANE ane wormecduse7eq wowonreserd Ax0| on Peat goueeuedep poucaqoent aqGusus crsqeusored ANPD FED ANE Baeemasq Gexsere}Hid cl osure of a Set of Fumetiomal dependencies ( i) Let F be a Set of functional dependencies : qhe closure of £, denoted by FT ts the set of AN q impiced br F functional aependencres wage ly Closuve af a set of aktyt buked Cay poe Let ¢ be a Set of attytbubes ond Fre Sok af fumcrtonmall depenclenctes: mine. C\OMxe OF KUCH gurncttooally detained F cS ene set Of au arrriHuce® denoted bY xt. Comontcal cover of a St of gurnctconet deperaessed{ fe ) [oneeee eee a Set ore by a undes F and we A canonical covet fo Fw a got Of FUBTHOTS | deperciencies Buch that £¢ logically gvopite> all Ps io all dependencres im Fo and fe togccally tem pite? deperdences Em & f. must have tne folloct OF propettcas * NO fumcktoon dependency ™® Fa comtains FO extraneous abestbute - % Gach left gide of a functronal dapandey by Fe te untae - Restriction of £ to Ry let £ be a Set Of functional depencerciog on schema R am let £i, Ra --- Px bo a decomposttion af R . The vestricttom Of F to R; ts tne Set FH t v + thak t AN fumctional depenctoncte® me tmeiwde omy attributes ot L2 Axes Strong's Axfoms ee 1- Reflextvety Rute > a x 1s a Set of atkyibubes and (ETS ta) x38 holds a: Augmentation Rule : Tf XP hads and x iS a Set of SEMHES then Yk +R holds. TFramscttvity Rulo: eee : Tt KB hoide and POT hads then X3y holds. These suUlO6 AYE goumd and compcto . + A procedure to cornpute F proceduve to compute 7 @ ft. F @ for each apply we fre vity any yules on £ ard add the reSULeeng fractional depe nce urncttona| de pewae functional deperdency fin pt A aug memtany mncies to FT. (B) for each pate of F 2208 $, and ft, in F + te 4, and 4, ca be combust UOTE dransitivity , 0dF the resutt[> functtonar dependency toft untt) Ft dees nok change amy furrctnes + Ad algorithm to Compute o< sc ig A Eel ke Se @ Tesult += @ While ¢ changes +o vesuit) do (@ for ech functional deperriency Por INE do begin if PES wesul =vesutt OV 5 t then wesult end _Cornputing Canonical Covey © *f=:F @ vepeat a+» Use the union rule to replace aAOY daperdenete> in fe of the 4+or™D ox, 2 Py and x, 3 Fo voutn oc > PP \ depanderr¥ x 3 inte b. Find & -functiona bute etther w With an extraneous atert! x or cn P TE awn extraneous att ute te ound , dejeta te fOr x 35 until F, dees wet charge Testing for Dependency Precervate™. festing for Depersen yy © compute fens ® for each schema R; i D 2o begio | Fy is the westrickiom of Fe eg; end @ =; @ for each seststclto FF do ( begtD FlaPlOF, ee, compute Fo > it pte rt) them sreturn (eT? ); else woturn( fale) >

You might also like