100% found this document useful (1 vote)
354 views78 pages

FULL DBMS Notes (All Units)

dbms aktu notes

Uploaded by

Puneet Sharma
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
100% found this document useful (1 vote)
354 views78 pages

FULL DBMS Notes (All Units)

dbms aktu notes

Uploaded by

Puneet Sharma
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/ 78
os}o7)ig DBMS sees 05 the infermedlicde bebween usex ond dotokase.h is 0. Softiume cksign to (assist) = iw sraintaining: ard valising loyge collection of data ; is & collection of data, ‘typically. . "sci ‘the aidivities of one’ oy move, oxgorisabios ; &-A uuiiversity chtobase may contain the .. ivFormertion obouc the Following: Entities such Os (students) Studerrts, Tocubhy, cooyses, classvoomn > Relodionships behween entities suchas 9 ' stideytt emellment cooases, Facubly: szaching coyses and the use of classrooms Advorroges of Dems :- + Tynpioved dato. shasing + eich Grd WES “hoe bel ccs rca ond bettey’ rono.ged cht: Data, vay» Net Dovel ot t hin OY YO¥E.. Servers» lin “Bag Vek, chic. should, be prevend orci’ tise dla by two oy Ail ager orange eTrpoved. dala gc os ae grits oe pe cag eee for: conyses: | ee eae when differedt vey cf the Some dhlo appeoy in diffeert_ploas- Eqi-A ry soles department sree ay yepresentodive’s os Bill Brown and Company 6, peysovio] department stoves nome 05 william: BE: Byown. \ ae 5. Improved’ dato. gecess : oat ‘ ; ‘The Dems ynakes it possible “b prockice quick answers to adopt quivies. Gforfis mo es = Dodo weel~&b o Hue print which contains ol) the “hsbiictons “4p build dodabrice that will meek all venduser reguements: : i to TE 1 the fist chap in dating, opens Data rode con facilitate mteyaction oyrerg the cesigner, opplicodion prograrnmey ond. evdusex f «Ey The, manager “ond clerk ‘beth work fon the SOMe...co The wonagey more likey to _ Stbepreneny view of dade “thon clei! . a a Dotan model basis: building’ Blecig = Entities, ott butes, velaHons ips ‘ond constraing | » 8, He. baste, bullng oblocns. of di yd These One. 3 types ~.oF Yelationships) 1) one to org Oeibapaht safe) atin Soe ah EMPLOVEE! mmamnages’ stire a ove, ployee on “yhaviage oe seipem 1 G25, Get thay Paoiy ov usr 0. be INTER PAINT PAINTING each one of them is pointed "by only one. poirrtey. Hi) Many bo oaxiy (hs) EMPLOYEE LEARN SKILL : An employee {Moy leom many” job skills, and each job sxill way be leaned by mony employees. Entity »- oe is ax thing bpevson, a place a. thing) e it Yeprecents a particulay type of object: = PRopuct, customer, STUDENT Attribute :- ’ fe An octbibude is o chosaclesistic of on entity. | GA (custome erty atthibudes aye customer ' Fiyst nome , last noyne ond age: as i | Relationship :~ : i Tt describes an gssodation among entities. Evolution of ‘cbda modes :- Hievaxchio) wmedel Ft contoins levels or, seqmerts,a segment ts the eguivolerdt ofa the system yecoyd ‘type: = From the diagrom, the tool seqment is the poyent of +the level-T segment which intern the Parents, of the level JL Segments avid so on. & Advaninges BBLI9I A — a ; ITE proms cla. shaving be } 2 foyent nd child. xelodoviship promotes dodo. ‘nbegyity Se icient uth |» 1M. yeladion ship: « gaameare Disadvarrtoges :- ets (a0 Compe pet MG = ges in “shuchue, ve Er i pplication! progiauns. level-IL portA part B As ore | Segments f ve Pa A ihe 4 7 Nesom mock = = (aarnitot> IM Imad + : " ; Meg | ei 1M ) = oe schema which the conseph a) organiseaion ‘ y the ertive database as viewed by the’ DBA (Dedokose odnimistyodpy) ols oh) eo SL oie schema. mnoludes definition “eEthe dota Isai nome, yecord: type pey eich vecord - the ae | = In “this model, A yvelotionship is colled ay sop. | F 2A ‘set | Yepyesents “owney yd © membey Yelotionship 5 , ge Adv RSH | Tt is mme flexible thon hievaychiaji 2-Qumer and membey relodionship promdlés nbeqvity. 3H cludes DOL and put... | Disadvan is i | I" Chonges in shuchue vequives ‘Changes m oll » sopplicodion program. | SHoalig + taller oi Entity Felotionship model = | Entity vepeserts . parkculy type of object m the veo) wovld: he 3 ! | An emtiby is vepresertad in the ,ertity »relotiovship diagram (ERD) by a Teclargle: i pd babivag Ett Yome is wrttten. in copettol: leHers ond singuloy form: | ‘ ; © UNE Oppluing the €RD, to the yedferlad ‘lvace! Qn errtity S\ wiapped tb a relational -talole. Entity is described by O sek* of octtyibutes ‘thot if describes the _porticulay Choyacteyiste == Ege the entity Employee will hove ‘odtviudes such os employee TD, first name, last name: ERyrodeh i, Advarrtoges :- = Is awa’ model ivag yields excoptional, coneptiol Simplicity. 2: Visual vepresertation wore it an effective communication ‘tol: Disadvarttages : There is no DMpez- Thee is limited conshain velattionship: ' Relotione) mode! :- In yelational model, yelotion is. called OS o table, each row in a yelation is called tuple each Colum yepreserts'an othibie 9 Tt is. implernerted through yelotiona) dodo management System (RDBMS): RDBMS: performs the same basic Prati provided by hievorchial and ‘network model »™ Qaddrton voto tha) it. supparts’ givthey Functions, thod rate the yelationship rode) easier th understand arid levnent- itp Reloti oval ad : , RDBMS ” “Toblenome : Agert raha cust oo Agem nome ‘dew ., 501, | AAA | 508 Bes | - ab 503 | ccc | --' Advantages = sane—1335v0M3 Psu ee iS. proved the use of independeyt” tables.’ 4 2 Chouiges m a toble structiye | iat co not atfect dota. Ones “Grd application 3Adhec Quieés is also ma — code Vi uae iiee ZUz 503 i 503 Advayrtages :- . 1s Visual modeling . yields exceptional), concpiiol Simplicity. 2: Visual yepreserrtation woke it on effective communication ‘tol: Disadvarttoges ‘= Thee is no Dp: Thee is limited constain velationship: Relatone! mode! :- : Tn yelotional model, yelodion is colled as 0 table, each row in a relation is called tuple each column ye presents * an othibide 9 TE is) impleynerted thyough yelationa! dodo management system (Rpgms)- RDBMS periorms the same basic functions provided by hievorchial ard ‘network wade! i dition vito tho! it: supports’ ther Tunctione,thod. mare the Yelationship vmode) easier tb understand ond a } 1 : : ; OI Bilt TS ce sehas * Toldenome : Agert -Tablename : customer Sart] ent Agent | A pe ieee ee ae ULE ola ich smclqetoo pet So eae ae Di orc VF ESS sees | 50a 503 Ccc a ‘coc , ' Advarrtoges :~ }-<230.cruoni> ; M3 I Struclinod independence 5 prov use Of ‘independeyit’ tables’ 2-Chovges m a table stuctuye that co not affect “dota. Qumnesg “Grd application. 3: Adhec Quiers is alse possible. ATobwey view: improves conceptua) sirmplicity, ensy way, of ‘design and implementation. 5 fowerfu) RopMs isolodes the endusey ‘from " physical level detnils ond big the _. mplementadion. | a Disodvartages : s “IS RDBMS Yequives system sottwaye ae bovd tae heo.d: (evel, a jt yla-wrr, ns 7 ‘(The dodo in the dtabase mm anagemertt is a *Oeecribe} ak three’ || levels jin sol a iy Physical scheme SUmmowizes how athe lative Solo in conceptuo) “schema Ove atualhy stored ' ie “are gies devices such as disks. i A. possible. values: (0¢), ceahe ey, bial coeDovnaing cs SS Se Aa A vey Meu iS a mmirnol set of odbabures ‘ie valves ete identities an “ in ‘the set- (Se¢9 | lempuovee] | elie ae seth ‘ol = ; wy! E yelotion oship Is ov “Assosiabion boehween “two SPtS: A Collection of eri relationships: io O Yeloctorship set. = Works — iN) abhor me m whieh wiih yelodion Ship indi aes depaxtment m which dn employee LIOYKSs =A velationshie can. also’ hove descriptive odtibutes These ove used +p record the ‘iformadon about the Yeloconship, yorthey thon ‘below ~ one OF the Participating emtities: SThis ifoymotion ig pnd be, Bid an ottribude colled Since. tw ye : ‘ ecenlc on Rican ipteet an > en partmen and location, | @2 @ Qe ia) ro ah gai. canis na veto ~“Sometim in ae

the Updades studert Yow vena yeote table Enyolled(cid vaychay(0), qvade Vo 0 | ctiid ivrt, PRIMARY key Studid cid), FOREIGN’ ' REFERENCES STUDENT (Sid)! on. Dele Te feast); ale ance ctul design withER wide) 70 ens Developing an €R diag var presents seveya) choices, including the following: h Should oO Concept be 1edelled On obhybute: Poe ently. © BE Should "O° do be ympdellad as an ebrtity ¥ OY oO chilli “Tt gS: Whot ae dhe élationship- eae and Shy a feviipatingent x(a Vs eran) \s Atbiides- | vie ah GH LP. identity} the odhibudes ofthe, sire pit iS, Meritage hk | clea’ ushethey 6 pynpert ; £ -Ghould bs ynedellled te x Sy © i) Eg: ip eben pe at Ne . etyore sept Nr ain The processor ayviving » geod ph Physical! sckeiy is colle! physiep| dbda bose sign td | Concephuol schema t- © oe Tk is also called as! legico! Laie >In RDBMS, the concephuad schema. describes | all velodions that ore shed in’ tHe dodal S Tt dedlé wrth tobles , Yelodionchips Ord. consbaints: External schema : = It allows the dodo. acres tobe atthe: of the level of _individual..ov group of -tsex => External a han oo '9 qe by. iy end-usey veguivementss.- > For ony given dosnt es exactly one moy hare seveyal exdeyol, schemas. | =>och extemal schema.” corsisis of o collechin of one oy ynove views ind dations fom the Conceptual Schema: fonit9 | > A view is coraphaly 2. Ee, e.. the. yecords im the view ove “tot shel in the = a = 2 -e ! & a : 3 S R oe database. ade can | 8 ’ in ae Loni "Mesdeicon of ek Yodel = Ford haegtt OTP S a one eo le pee Ratt. mv Sg calection s 3g anes ony | van ality pea | phe feueee 5 fox. further: moditication we mnigits break down on -addyess }yip cownby, Stade, ect | Zip code: For another exomple © oF ae toe model a Concept as an entry set yacthey than an othibte: H contains alvibudes cea and. ‘ = be Since: ere TH is possible’ i an employee en WOM mo given eb, over nove ‘than’ one period: We con Ree this voblem by Nboducing a entrty Set DURATION \iwrth odtvibules from and as” ‘shoisn in the Belov. diograrn: the Problem Lorth this mode) is” the budhe | IS QssOciaded) With “the veletionship wheril § actually assoctated with cthe managers 1 ~We.. can -solve- this problem by mbvodhucing f entity set called monger: f 0") mat) "Rom and +o ave the athibudes of manage enuty set. , NADL v0.19 .93)07)13 Bivoyy \s Ternasy Yelationship ‘gli wheels @!’situadion In which oh employee / can won seac] policies, each pebeiaah be wey) by ceveya! Employees ond each cependeyt Con be covered by Several polities. Suppose tho goo. hove the ollovi additional veguirements: fev ey: A pole Policy con not E 4 - LOM (ffoes Paige 7 a eee a file hinii ote AS vis Beery ispolicycamust te bisned by ~ som 1S 1 Qu WweaKor-entt LVe Y a pt a6|as ; ol Leia ae Desi dae ty ete model) :- We know , vee how? +p translate an && cliagrarn into a collection of tables: Entity, set 4 tobles = An e set S|, mapped ts 2. relation IE adh ea of -the eae, set is becomes an aithibute a oe dint 4 | name _| AAA, ae yo mysgh ecreaze |: “empfesn voter} bin Seb a abe sill ie leche shdlah ce Hey , sagen ue oes eal enor A yelactionshi set, | «osu PRE tas? yYyoray 22S 2 Oar a. an Gaines floc RH) Create toble worxs_in nee varchdytto), did int, acldress vorchay(ie), Since Date, Pyimoyy Key (ssn, did saddvess), caf . Foyeign Key (SSn) REFERENCES EMPLOYEE Koni sm), Fovelgn Key (did) REFERENCES DEPARTMENT(did), a rae Key (acthess) REF ERENCES LocaTion gies s)) levy ;- ss Liens is a virtual -toble oy j of - cwoView consists oF Yous one Ser Just Ike a table. A view is a’ +toble whose” yous ‘oe ‘net “te hci ‘sted m “the: douabai 4 i 1943 | b ie ibe Vieug pe the v complet ‘of the “dota ¥ pra a eid 3eiS-)) QO, for) woliy SsmoyY — EH toes less amount “of “Sp eb abe Spf, Sone Be vous hale sie Hanis tak mysql > creode view customerview as select id, Name from custorney;)? 7 To get the datafiom view anble; | | my — 9 for customner—view 5 . Name Hiuboed ‘i AAA a BBB 2 ccc ray “a = 4 DDD | Bet» belek i Upeading a void ne eG A view con be ple rele: ‘cerlain. Conditiond:”) «i eaxbho 2 The select ae ait er éovrtam the key oe distinct. bt) aA The ‘select clause may pane Caan, the set opexcetoys, 0g qreqation functions, ovder by. clouse: The: quiety wey meee ontain ¢ gyoup, “ aydey by oy having i ae shams riage bernmpdit te pplot iB «} ’ : UNIT- at aire Relocional Algebra ond Rebdional Colculus ey Ape . hese wer Farguoges axe specified, larguages for OSKMG Questions oy guieries le the cbto. m the dada hose. Dui ee It. vepyesents “Lup toreadil~ puter thine son | | ee with the relia) rod” wevies in yelational alget a a ie 0 callctin of Gembe ed ench Wqich oecres 0. step by step proceduye toy computing Eyagjele sived ansue clog Relational caleudus\iin~ which a: guitny decsbe the Gesived | answey:| withoud’ specifying “how the onswey Is, trent comptchbetlicitin Yao! braxhatve: . A wy IS. evaluated: using tetas “Ot Each Input velagion ‘ond, th produces” ay instance of the ““Gdpud yvelaton. svat |. 2 smlee vy A POS wethieo. , hal f pd : : Lal oa (BR 58 _ Tnst 3 'R IOfio/as Lije}9 R, oF ves 4, x9) pribor fie” These operations Glow to rrionipuJade cata Wa Single yeledion: | r——— (Se) nya Fie 4 — ¥ cid —any = 4 ee Y ne 8 Sic “>NOMNe varting ane aes Yappy 9 a5. 55 Rusty iO; 35 ms « | (Sa) . SMe, tading ease (ua Cublee | Seery ! Rusty 10 » 3 The selection. condition is: Boolean “comlomaboy of tews Hot nse: the fw attyibude , operaday constant (or) atbibutet op arty} bude 2 Lwhere op 1S one of _the compasision’ opevatoy He <5, >5;<9) | The projection’ opevatoy (tt) alow to erchad Colums from a velotion. 7 We con find out all ‘ sailey Yomnes and eet) 121 os Find out only the ages oF sailors: . af rh Bd ais Magel nici | 5° —— ‘e » Sv ae bine the “quievies ‘ala. ' nee nea “* ‘| op bs “select! Frame , ) Sie or. Ll oe 5) }08} 13 Set Opevators : g f “The Follousing Standaxd Litton on sd aye ol Available in yelatioval Algebra. Union (u), 2 Tntexsection (a), > Difference (~), 4+ Cross product (*). fon (uv) i | RUS » Yetuins av relation Instarce containing all “tupks thet acu in ether’ Yelodiovio) instance R (or) Yeloctional, Instance S- (px) both: R ond 5 must be unioyi caida Two yelatonal instances oye said +o be union Compatible, if the Follousing conditions hold IsThey havethe same no-of fields: Qe *Conresponding fiélde toren in ovdey lert b } wor i9 shove =the? ‘same domains: , Ma 1 a iq. Pr A Ras ckintal 9, B= noitps|se ba hayall< 7 | ‘touples Hho: oo m beth R ond S- eg) we oe ; Wwitorsq {2 roy 1B, ASy woiet NV (arn teary oat 27/07)I2 oS Between opeyodnr :- t Syntax l Select * from +toble_ name where column name between yolue 1 and value 2; Eq:-Selet » from emp where emp salory between lO000 «ard 30000; a a fa Select » from -table_nome where Column ame in (volues) ; EG :~'Sdlect » From emp whee address in (‘India’, ‘us! IS Nut opeyatoy :- Syntax ‘- | Select fiom table-name whee cokwrm vame Is NULL 5 : €q}+ Selects Tom emp where address is: NULL} a ‘LiKe opeyodny be r renee (x) :- 3 Yy RES Y etuy ¥6- .A' VE lational ist ANnce ichnse Scheny, Cotas. all the fields of R (in the same OYdey as they Op peoy iY) 9) Toller wed by aJ! ‘the fe) ds S {in she cn Oey as “they oppeay In as Sid svrome vorting age sid bid Coy a2 Dust ia 45 22 lol -lofolas | 4 Bysh, 22, 45. 58 |03 uhalas : 3! Gublee 5 55 22 Jol 4tohelss 2 Giblee 8 DD. §g)103 a filqs 5% Rusty lO 35.) ga sqo} loholas 58 Rusty IO 35 be. 103-_nhesas balos ie oat = 7 ‘ The join operaction | is one of the most usefu Operations mn yelciovel opey algebra and most ioe: ‘combine the fplotaestion From - ) con be defined Q5 0 creas pent Y SER and Prejacterry i J, fk, sdect ¥ fore Soult nie) ailoy pS tthe" 3)" *sid< Rysid CSO 241 sid i J a] sel ra [3 , Dustin: | Be | io3| whales dice 55 | 53 | los! whales es ion 2 OA hard iii! case of the join operatoy Reas usher the jo operation consists of | cea eae eqpaliny= of the ‘hrm: | — 3, Sid= =Ry sid ame [vaing Tage [ bid [doy 45 Tom loftofis} ork [aplans ‘Note thet one field rola sid appears _ in nthe | yesutt. Select efi Canes whene sojlers: gid = Nato) job’ ae ag Tn this ‘case, we con, 4 Simpy ova! the jom condtton, the defoult iis. tek” al {gin enepltioe is | a collection” of equalities on all’ _ coremon Fields. lle coll this os spacial case Noduyal joins The equi jom expression GS g E208 \\8 th Division opevacion i- Y Considex ‘tiup Yeletioyral * watts A. and RB mn whichA has exacty’ two fieldsx amd y and B has Op Field y tutth. the same biewetlit afl Ih As Le define the division operation A/g as the Set of oJ] x values such that “iy ever Value 4 B, thee Is a touple in A Sno pno Bi Si" PB | a. _ , Had, ON > Pp : w Oo _> * se ; 23 Sa Pa Bs [Pri] Sz Pa Fi x SR i ) oer, | a | i i oF Algebraic guiertes.. = IY age. =, yy OK 4 10. | 32 pee Ss oO rN d a eS Heeiie ef worms) A TRc has the tom {Tl Anfiwhee TF is ang Variable ord pi denotes O fownula which Cech be Syrtox of TRC quieriés :. Rel be a yebtiona) nome R,S be the tuple Voyiables ,o iS an athibute of R,b ts. an eee of s, let op denotes an operdoy iin g RE Rel RO op Stb R:a op constant (or) A. covimule is recuysively defined’ 4p “be one tee the ‘ollowing, whee p and g ove +thenselves formulas and P(r) denotes a formilo in “hie | the vayiable R Oppears: os se Gere ood a | WR) ng , 3% oe guontties °° md Find the names of aa Bi es oe | Tie thon’ qa is fsb es above 7 7 (aubyasg 10 Spy SE satea ly syns | sid bid day dd, 10) | tofto}9g a2 102 — tofio}as rt M2 1031 0/¢/98 ‘ad 104 so] 9g St 108 holes 3) Ina 11 /6]98 31 14 h fia/98 6+ lol Js fag R | Il Find the names of salloxs, who -vesewed: the » boad 103: ; dugalor 9A Tlnaee (TrpsRsoves ea mils) » Lao Bovurevop coli & Find the names of sailors! eee ane boat: OF: - Tinarne (Trower eS bd Réstnves pe saibr) Bg eee tks HAM Fred the cols of hoods vesewedl by Lubler? -o6}ve)t8 Meolow (rare Gis D2 eve Bie fails) a 2 tuple . Relational Calculus (Tee) ~ 291 Orr ath banks 2 “quiet locional calewus is a non-procedua © ou is alse Doman Relational Colawus :- DRC uses list of attibutes tp be selected fo the yelaction based om the conditorlt “is same as TRC buds differs by Selecting actribudes rothey moe selec core soho” tuples: {B44 3] Pla ef : seen e diten [orc formula, let X and Y be domain voylables- WL ght LBE Rel Xop y Xop constant | (ov) op constant x ~ A formula is recursively defined +o be one of the tollowing where pond gq ase themselves O formula: Land poo cenotes a formula in” alee the Vayiable K OPpears:, bere ie, SOC hao TPs Pag, vg P22 -youg Hy (Poo), 0 iS QO domamn Variable * eee NE a x (Fes) pies pra a “the vomes of Sailors Boe a is. ai Serna ln Stab Sif ap The set of such S tuples is Oovioushy i r This example Says thee“ an unsate’ query: Hie clesivedtle to yestict a Colowlus wD sa unsafe quieiies: Now we sketch how the coladus ove yestricted tp be soe: Considey a set I of yveldtonal instaiies , wth one Instone in O-velation thet appenys.- nm Q query Gs Let DoM (a,x) be the set of loll constads thod: Appeaxs in these yvelotiona). «instance J oy in the formation of quiesy Since we. allow only Finite instances a Dom(e,2) is. also finite. | Finally we con Sheu thet every guleny “hat Con, be expressed using a safe yelationdl ‘9, quiey and also be expressed 0S 0! ead pipe i | Ca ola oy (6G x. (eA 6 (og) x / ie a Sue * fa Alok wri fivoxed by va yespons b get avis gui ies La fl he r activoced. 7 bye Reare TRIGGER init. gaunt BaTARG INSERT ON STUDENTS DECLARE | *Geyt e!! Court } . BEGIN COunEED, Jae action END, CREATE TRIGGER iver-count AFTER INSERT ON STUDENTS IHEN (newrage >13) | conditions| FOR EACH ROW BEGIN | #ACTioN*| Count = cout+1- END, oer H the acton “per ayy ie thdivi dual changed yecovds: hi tae aioe tel of de reevted student vecord whether increment the Count oy not: | Foy each clause is used to do this, such trigger is called vow leel triager ~, we omit fy eh va tinge ie called = statemen ‘ppel'® UN IL — Depende be A Yebtion with Tedundancy con be “lefined b Ceco mposing (oy) replacing with smaller relations thot Contam the» same intovmocion but without yedu TE is twhended sa, addvess and a, tHnemegt Approach based py decomposition: ne Stp of information” is, the att Cost tor’ th Ac batormockiou. problems. - | Storing nike same ifoymadion tigilealt means yore thon ome Place with mm the Can lead tp coveral problems: Ivéerytion Anamalies : - @ ; va bat.) way not be possible tb Stove. ate nfonmedion’ Unless Somme othey,, voveladed, indonmadior = iS” ‘stoved | OS welk | ist lice ab +o gpm ont po Dvsertion rami py ered Occws he: Ertan. bbe a Inserted Arty the _ dodabase yo thee doa base 04 yee whod happens if student S39 Is 4, ter he eon _fnformotion about the couse. ts. best. 3 ie, Aromalie : Im i hil cast Se One Copy of. such yepeated eel re d, on pis is cyecded unless all Opie = eee lot voting, ously . ges, os. } ae toy hourtiy vary emp IS. ssn. The hour hy determined | by the | aS attyibude- at ie houyly_ ds or ody a 4, ep 7 rm be we need .to..evercome; Hiob\by rato. b Seiligearrh q ois I ss «fd Sed 5, [ntal i 3s Eq a: Geode toble shid 5, int ,sq int, Sint, div axhawa create trigger tt before insert on ola toy each Yow , begin ((C:newss, +: NELY! Sy + iNew: Sys) >= 60) f sett ivy student (S1,Sa,$5) V Values (0 20 rer iF new: div 1: First class’; ' i end # ; . eee a CAs insert intp stud (5,,S», Sz) values (“10, 30,60); 4 bsarenyt ee * tom = eb Pore mi 4. | ; bor 5 at i ODS Inghiste batraeny Or tread Coty Aiwe ett sb na bonis ai seunl> roa vol a “a ~ » ei opt ib A decomposition oF yeloctonal: schema *R oe consists of replacing the yelation schema my oY move velotion schemas +tho¢ each composite Key, uh has Yrovethan one ettyi buds. vIF A+, A is » alle Pere and" Bois | colled dependents ser. decomposrtons howe veces 10) , ! tees jem Property 4: Dependency preservaction properly 7 1: Logskess ~ join: Property : , St enables us +o yecover Qny Instance of clecomposed relation fiom Cowes ponding eae of the smaller veloctions- &- Dependency presewvattion | eee. ' Tt enobles us evtoyee | any capital on the original, we by Simply evrfoyciv Some constants on each oF the ey | Yeloctions. . — aolosiis : @ Normalisoction :- Tt is ‘a: process P ie ie cowed toble as mmimize ea a , theveby reducing | cata, anornodies. ~ Ferproviding good table, abuts ual Ce good tobte shuchye. decober, Leis, The vrormodization obs The objective oF romalisocion is +o -enswe -thod: each! table confivns. the eg oF well. formed me yelotions: ‘thot means ‘tables “hasing ‘the ios. Yeloctionships. a 1! Each -toble etiooeit Q single. bbisct: & lhe. student .. ‘will contain’ onl student dodo _ The Yeason fey jth vequivernert ls tp Ensure thot the’ peroane Shp be “updated only Gt; one’ place ‘ i earthen Fone. to fist Noma! form: . Eliminode the vepeacting 1 i A yegretmg Group _ devives nome. Be, 4 tact nt qyoup oF multiple etties -of the Soine’ type can exist io. ony sige Key octtibu occuwyance: _ Staxt by presertin the coda in’ O “tocbudy toymot where each el! has -o single value co theve bn0 _ repeating wadures: qrOUpS: bea Toentrfy the primosy Key '- Any key vuniguely icestttfied all of ale. | yemaming YOU othibudes: PROT-NUM is vot an. aceguate| proper Primary Key becanse PROT.wumM doesnt uni identified oll of the yemaini vow odtvibudes ‘To weivrtain a pyopey pri See ‘key thot will Uniguely ideistHied Oony” Oxtky value ,-the new Key — be: eT of Sp w emp_ int chibi ST] cams ina are Bien all deiceners, HE Sone Pr9}—-Nusn, emp. mum: —> pyoj_nowmne , emp-oxne, job-; cls, chq—howy, hows_iorned aie “Mp_name , job- class, chg-houy job_ class — Cha ~houy f P. | Write each Key component ‘on ‘o “separate fag Y Write each key component | on a Separal, lime cond - write. the otiginal amg a the lost |ine- Pr0}-num mip —nuw oe be { proj-yum, emp ~ ~YNUN | Fach component will. become the ie Mo View table: In othey eile, the ovigmal, tobe ts divided il 3 4tables ie. pine) oh ond assignment: Assign ener dependent abbithubes | The 5 new tables . project, employee and ' assignment | Gre described by the ee Yeloctonal schema: . project (proj-num, proj vain) nae, employee (emp_num, ernp-nome, ae ren chg hou) assignment (projnum, emp_nwm, , Assign -hows) Because the Yo oF hours : spent “on eich i by each eriglayee i iS dependent ‘on * ee Emp-—num in the assignment tobe: To place those hows iv pei “tobk OS Assign— hows: x TF you | want i add siege’ ‘ov reed d Pyoject record your need to qo 1D. the project stable .ard -to .ynaxe ~ Oe ale en our WAl 3 ~— Postial, dep enden i Pray one is used ‘ eee Proj-niame thot means Pro) narne IS depends oy) Only» port of the Primoyy Key. Sinillovly emp-nowe, jb—class, chg—houy aré cbpends on Pies OF the primey key) A. clependen basal on only poy: of sits eee Key IS colld a partial] clepenclencyy 4 ‘Tyansitive depenclency :- Chg how is Cependent on {ob-class- Heve oe Ond job-class we not prime atyibuctes- A dependency of- one non-privne odty\ bute oy) another non-pyime attributes is called Lonsitve dependency. | nF (Proj—nuvn, 2 Emp_yiumn, prg_ nome cepa plas, chg- houy howys- Worked) | Poxtia] Prj—rivn a Bag nhac sjoo—Clas, chy. how | “Tyonsrtive depen , oe TJob-class —> cho. itty > ath me | Now +he toble satisfies | nr yequivemerts- The problem with the INF table shuctue is thot it .Corrtans igo SE BD\O8 Eaves on tD.3NF ia | - Convertin ty 2-NF. done: ‘onli when vaactas a Koriatle primayy een TF the INF hos a eee key, ‘then the q toble is Qurtomodically mM QNnF 1 NF to &NF conversion is simple |espatiaiaeiaias. a From the ‘ above table. Shuctoe, stil shows 9 ‘tyansistive g ependency “ishich cain generate anomalies: 3b “ewe que} gwar pve fe example, .cho_houy. changes ."fo¥, a job Clossrficadion held. i , bY pany employees the ust be yrack fy each. .of he Ce, yecovds +thaot ‘oye affected by the chg—houy choyige, employees iuith “the same job. chssfication il ) Hy 2S (clo_houy).. bite Qevieyate houxly potest Pru jai Conversion tp SIME a3 cueing) hrerempiach ~ Adertty each new deteyminart - Foy every Woshtitivé ‘dependency, write its cependent as a primany. Key foro. nelu “table. A\ determinant “is any athibute’ whose value ceternines the othey volues nM A YOW: | TF you hove Hee. different transitive dependents es you will hove tee diffovent deteyminants- ‘In Ouy example »yY one toble _, dood coyttains gent Ja! 1h yes ; _ mh oO -tonsrhve dependency These-fore, witle the d cle Tor ee TO eitng ' Cepend aS job-class: T= job- Oe aon how Tenth the clependerrt obbibudes - d _ TD = job- class — chq- hoy Hee Cha-how ts thé depercentt attyibude | Remove “the dependent odtyibudes rom the ' -yonsitive dependencies ‘ Elimmote oll dependent sats mn i -yonsitive velodionship 467°" each cr the tables thot hove such O bonsitive Yeladionship- In this example, elimiade ; ng hs 7 ~ the employee toble: ! Emp_viun—> Emp-name, job— abs 0 Note that job class ' yemouns in ‘the ve - employee ‘table’ tp’ ‘seyve ds’ the Foetgn yey. oy Aster SNF cenveysion “Wos ‘been “Complete your dodnbose : corrtaivis - 4 tables. C ee ‘PROJECT (Proj_vewn, proj “nosne). HOTHH + etiployee (cmp_riwm, emp_npne, jobaclass), job( job— class, ch —how) ” . Assignment es, ee pee a : aoe name] jab- loss} |

You might also like