Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

05 Database Models

1,822 views

Published on

Database Management System 1

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

05 Database Models

  1. 1. Ins to FOR-IAN V. SANDOVAL truc r: fvs nd va ya o o a o l@ ho .c m http w .s e ha .ne a o l ://w w lid s re t/fvs nd va
  2. 2.  A d ta a em d l is a the ry o s e ific tio d s rib a bs oe o r p c a n e c ing ho ad ta a eiss ture a us d w a bs truc d nd e .  Als kno n a Database Schema o w s  Sc m s a g ne lly s re in a d ta d tio ry a he a re e ra to d a ic na nd o n us d to re r to a g p a d p tio o the fte e fe ra hic l e ic n f d ta a es ture a b s truc .  It a o d fine a s t o o e tio tha c n b p rfo e ls e s e f p ra ns t a e e rm d o thed ta n a .
  3. 3. 1. Hie rc a Mo e ra hic l dl 2 Ne o Mo e . tw rk dl 3 Re tio l Mo e . la na dl 4 Entity-Re tio hipMo e . la ns dl 5 Ob c la na Mo e . je t-Re tio l dl 6 Ob c Mo e . je t dl
  4. 4. 1. Fla Mo e t dl 2 As o ia Mo e . s c tive d l 3 C nc p . o e t-Orie dMo e nte dl 4 Entity-Attrib -Va Mo e . ute lue d l 5 Info a n Mo e . rm tio dl 6 Multi-Dim ns na Mo e . e io l dl 7. Se a Da Mo e m ntic ta d l 8 Se i-Struc . m tureMo e dl 9 Sta Sc m Mo e . r he a d l 10 XML Da b s Mo e . ta a e d l 11. C nte Mo e o xt dl
  5. 5.  A hie rc a d ta m d l is a d ta m d l in w h the ra hic l a oe a oe hic d taiso a dinto atre -likes ture a rg nize e truc .  All a ute o a s e ific re o a lis d und r a ttrib s f pc c rd re te e n entity typ . e  An e ntity typ isthee uiva nt o ata le e q le f b .  Ea h ind ua re o is re re e d a a ro a a c ivid l c rd p s nte s w nd n a utea ac lum ttrib s o n.  Entity typ s a re te to e c o r us e re la d a h the ing 1: N m p ing a okno n a o -to a re tio hip . a p , ls w s ne -m ny la ns s  IMS is the m s re o nize a us d hie rc a o t c g d nd e ra hic l d ta a ed ve p db IBM. a b s e lo e y
  6. 6. An o a tio ha re o s o e p ye s in a ta le rg niza n d c rd f m lo e b (entity typ ) c lle "Em lo e ". In the ta le the w uld e a d p ye s b re o b a ute /c lum s h a Firs Na e La t Na e J b e ttrib s o ns uc s t m, s m, o Na e a W g . The c m a a o ha d ta a o the m nd a e o p ny ls s a b ut e p ye ’ c re in a s p ra ta le c lle "C re m lo e s hild n e a te b a d hild n" w a ute s h a Firs Na e La t Na e a d teo ith ttrib s uc s t m , s m , nd a f birth. TheEm lo eta lere re e ap re s g e a p ye b p s nts a nt e m nt nd the C re ta le re re e a C hild n b p s nts hild s g e The e tw e m nt. s o s g e fo a hie rc w re a e p ye m y ha e m nts rm ra hy he n m lo e a ve m ny c re b e c c a hild n, ut a h hildm y o ha o p re a nly ve ne a nt.
  7. 7. EmpNo Designation ReportsTo 10 Director 20 Senior Manager 10 30 Typist 20 40 Programmer 20 •W n theP a Ke a ac m o fie , it isc lle a he rim ry y s o m n ld a d foreign key in thes c nd ta le eo b .
  8. 8.  A tre s tureis a w y o re re e e truc a f p s nting thehie rc a ra hic l natureo as turein ag p a fo . f truc ra hic l rm  It is na e a "tre s ture b c us the c s ic md e truc " e a e la s re re e tio lo ks a b like a tre , e n tho h the p s nta n o it e ve ug tre is g ne lly s w up id d w c m a d w a e e ra ho n s e o n o p re ith re l tre ; tha is to s y w the ro t a the to a the a e t a ith o t p nd le ve a theb tto . a s t o m
  9. 9. A tre s ture s w e truc ho ing the p s ib hie rc a o s le ra hic l o a tio o a e yc p d . rg niza n f n nc lo e ia
  10. 10. 1. Inte t: Us ne hie rc Do um nt Ob c Mo e rne e t ra hy, c e je t d l's lo ic l s ture Ya o s je t ind x, Op n g a truc , ho ! ub c e e Dire to P je t c ry ro c 2. Info a n m na e e De e De im l Sys m rm tio a g m nt: w y c a te 3. Ma g m nt: hie rc a o a tio l s ture na e e ra hic l rg niza na truc s 4. C m ute Sc nc : b ry s a h tre Re -Bla k Tre o p r ie e ina e rc e d c e AVL tre e 5. Bio g e lutio ry tre lo y: vo na e 6. Bus s : p m s llings he e ine s yra id e c m 7. P je t m na e e w rk b a o n s ture ro c a g m nt: o re kd w truc 8. Ling tic (s x): P s s turetre s uis s ynta hra e truc e
  11. 11. The a m ny w ys o vis lly re re e re re a a f ua p s nting tree s ture . Alm s a a , the e b il d w to va tio , o truc s o t lw ys s o o n ria ns r c m ina ns o afe b s s s o b tio , f w a ic tyle : 1. C s ic l no e la s a d -link d g m ia ra s 2 Ne te s ts . s d e 3 La re "ic le d g m . ye d ic " ia ra s 4 Outline a tre vie s . s nd e w 5 Ne te p re s s . s d a nthe e
  12. 12. C s ic l no e la s a d -link d g m , tha c nne t no e ia ra s t o c ds to e r w lines g e : g the ith e m nts encyclopedia / science culture / art craft
  13. 13. Ne te s ts tha us e lo ure o inm nt to s w s d e t e nc s /c nta e ho p re a ntho d o +------encyclopedia------+ | +--culture--+ | | science |art craft| | | +-----------+ | +------------------------+
  14. 14. La re "ic le d g m tha us a nm nt/a ja e y: ye d ic " ia ra s t e lig e d c nc +-------------------+ | encyclopedia | +---------+---------+ | science | culture | +---------+---+-----+ |art|craft| +---+-----+
  15. 15. Lis o d g m tha us ind nta n, s m tim s c lle ts r ia ra s t e e tio o e e a d "outline " o "tre vie s s r e w ": encyclopedia science culture art craft
  16. 16. Ne te p re s s ac rre p nd nc firs no e b Sir s d a nthe e , o s o e e t tic d y Arthur C yle a y science, ((art, craft)culture)encyclopedia
  17. 17.  A hie rc a q ry isatyp o SQL q ry tha ha le ra hic l ue e f ue t nd s hie rc a m d l d ta ra hic l o e a .  Sta a SQL s e ifie hie rc a q rie b w y o nd rd p c s ra hic l ue s y a f re urs common table expressions (C ). Re urs c ive TEs c ive CTEs a s p rte b s te s inc ing IBM DB2 re up o d y ys m lud , Mic s ft SQL Se r, Fire ird 2 nd P s re ro o rve b .1a o tg SQL 8 . .4  An a rna lte tive s x is the no ta a C ynta n-s nd rd ONNECT BY c ns t. "CONNECT BY is s p rte b o truc " up o d y Ente ris DB a Ora led ta a e rp e nd c a bs.
  18. 18. SELECT select_list FROM table_expression [ WHERE ... ] [ START WITH start_expression ] CONNECT BY { PRIOR parent_expr = child_expr | child_expr = PRIOR parent_expr } [ ORDER SIBLINGS BY column1 [ ASC | DESC ] [, column2 [ ASC | DESC ] ] ... [ GROUP BY ... ] [ HAVING ... ] ...
  19. 19. SELECT LEVEL, LPAD (' ', 2 * (LEVEL - 1)) || ename "employee", empno, mgr FROM emp START WITH mgr IS NULL CONNECT BY PRIOR empno = mgr;
  20. 20.  Theo ut o theq ry w uldlo k like utp f ue o o : level | employee | empno | mgr -------+-------------+-------+------ 1 | KING | 7839 | 2 | JONES | 7566 | 7839 3 | SCOTT | 7788 | 7566 4 | ADAMS | 7876 | 7788 3 | FORD | 7902 | 7566 4 | SMITH | 7369 | 7902 2 | BLAKE | 7698 | 7839 3 | ALLEN | 7499 | 7698 3 | WARD | 7521 | 7698 3 | MARTIN | 7654 | 7698 3 | TURNER | 7844 | 7698 3 | JAMES | 7900 | 7698 2 | CLARK | 7782 | 7839 3 | MILLER | 7934 | 7782 (14 rows)
  21. 21.  The network model is a d ta a e m d l c nc ive a a a bs oe o e d s fle le w y o re re e xib a f p s nting o je ts a b c nd their re tio hip . la ns s  The ne otw rk m d l o a s d ta us oe rg nize a ing two fund m nta c ns ts c lle re o sa s ts a e l o truc , a d c rd nd e .  Re o s c nta fie s (w h m y b o a d c rd o in ld hic a e rg nize hie rc a ra hic lly, a in the p g m ing la ua e s ro ra m ng g  C ts (no to b c nfus d w m the a a s ts d fine SeOBOL) t e o e ith a m tic l e ) e o -to a re tio hip b tw e re o s o o ne ne -m ny la ns s e e n c rd : ne w r, m ny m m e . a e b rs
  22. 22.  The ne o m d l is a va tio o the hie rc a tw rk o e ria n n ra hic l m d l. oe  Theo e tio o thene o m d l a na a na in p ra ns f tw rk o e re vig tio l s : a p g m m inta tyle ro ra a ins a c nt p s n, a urre o itio nd na a s fro o re o to a the b fo w the vig te m ne c rd no r y llo ing re tio hip in w h there o p rtic a s la ns s hic c rd a ip te .  Re o sc n a ob lo a d b s p c rd a ls e c te y up lyingke va s y lue .
  23. 23. 1. Turb IMAGE o IMAGE is the p a re s n tha the HP 0 0 w s a rim ry a o t 30 a s c s . It is a re b , s p , fa t d ta a efo MP uc e s lia le im le s a b s r E. Afte a o a d c d o e nc m nts it w s re m d r b ut e a e f nha e e a na e Turb IMAGE, the Turb IMAGE/XL a r the P o n o fte A- RISC m ra n. P g m c n a c s a up a ig tio ro ra s a c e s nd d te re o s us IMAGE intrins s To a it is kno n a c rd ing ic . d y w s IMAGE/SQL b c us it inc e a SQL (Struc d ea e lud s n ture Que La ua e fro nd a c nt-s rve s p rt ry ng g ) nte nd lie e r up o fo P a c s o . r C c e s rs
  24. 24. 2 IDMS(Inte ra d Da b s Ma g m nt Sys m . g te ta a e na e e te ) IDMS (Inte ra d Da b s Ma g m nt Sys m is a g te ta a e na e e te ) (ne o C tw rk) ODASYL d ta a e m na e e s te a bs a g m nt ys m firs d ve p d a B.F. Go d h a la r m rke d b t e lo e t o ric nd te a te y C ullina Da b s Sys m (re m d C ne ta a e te s na e ulline in t 19 3 Sinc 19 9 the p d t ha b e o ne b 8 ). e 8 ro uc s en w d y C m ute As o ia s w re m dit C o p r s c te , ho na e A-IDMS.
  25. 25. 3 RDM Em e d d . bde RDM Embedded (fo Raima Database Manager) is r a hig p rfo ing AC h e rm ID-c m lia o p nt e b d e medd d ta a e m na e e lib ry d s ne fo b th d k a b s a g m nt ra e ig d r o is bsd a ae nd in-m m ry e b d e s te s a e o m e d d ys m nd a p a ns RDM Em e d d c n run p ly in m in p lic tio . bde a ure a m m ry (a o kno n a a in-m m ry d ta a e o e o ls w s n e o a bs, r IMDB), p ly o d k, o in m d m d s ring p rts ure n is r ixe o e to a o the d ta e in-m m ry a p rts o is RDM f a st e o nd a n-d k. Em e d d ha a p ve tra k re o firs re a e in bde s ro n c c rd t le s d 19 4 c unting o r 2 ,0 0 0 ins lla ns in a 8 o ve 5 0 ,0 0 ta tio ll kind o e b d e s te sa a p a ns s f m e d d ys m nd p lic tio .
  26. 26. 4 RDM Se r . rve RDM Se r isAC rve ID-c m lia c nt/s rve o p nt lie e r e b d e d ta a es te d s ne fo b th d k m e d d a b s ys m e ig d r o is b s da in-m m ry e b d e s te sa a e nd e o m e d d ys m nd a p a ns p lic tio .
  27. 27.  A d ta a e b s d o the re tio l m d l d ve p d b a b s ae n la na o e e lo e y E.F. C d . od  Re tio l d ta a e a w the d finitio o d ta la na a b s llo s e n f a s ture , s ra e a re va o e tio a inte rity truc s to g nd trie l p ra ns nd g c ns ints o tra .  A d ta a e the d ta a re tio b tw e the a a bs a nd la ns e e n m re o a d in ta le . rg nize b s  A ta le is a c lle tio o re o s a e c re o in a b o c n f c rd nd a h c rd ta lec nta thes m fie s b o ins a e ld .
  28. 28. 1. Va sa a m lue re to ic 2 Ea h ro isuniq . c w ue 3 C lum va so thes m kind . o n lue f a e 4 Thes q nc o c lum isins nific nt . e ue e f o n ig a 5 Thes q nc o ro isins nific nt . e ue e f w ig a 6 Ea h c lum ha auniq na e . c o n s ue m
  29. 29.  This p p rty im lie tha c lum in a re tio l ta le ro e p s t o ns la na b a no re e tingg upo a ys re t p a ro r rra .  Suc ta le a re rre to a b ing in the "firs no a h b s re fe d s e t rm l fo " (1NF). rm  The a m va to ic lue p p rty o re tio l ta le is ro e f la na b s im o nt b c us it is o o the c rne to s o the p rta e a e ne f o rs ne f re tio l m d l. la na o e  The ke b ne o the o va y e fit f ne lue p p rty is tha it ro e t s p sd tam nip tio lo ic im lifie a a ula n g .
  30. 30.  This p p rty e ure tha no tw ro s in a re tio l ro e ns s t o w la na ta lea id ntic l. b re e a  The is a le s o c lum o s t o c lum , the re t a t ne o n, r e f o ns va so w h uniq ly id ntify e c ro in theta le lue f hic ue e ah w b .  Suc c lum a c lle p a ke . h o ns re a d rim ry ys  This p p rty g ra e tha e ry ro in a re tio l ro e ua nte s t ve w la na ta le is m a b e ning a tha a s e ific ro c n b ful nd t pc w a e id ntifie b s e ifyingthep a ke va . e d y pc rim ry y lue
  31. 31.  In re tio l te sthism a tha a va sin ac lum la na rm e ns t ll lue o n c m fro thes m d m in. o e m a e o a  A d m in isas t o va sw h ac lum m y ha . o a e f lue hic o n a ve  This p p rty s p s d ta a c s b c us d ve p rs ro e im lifie a c e s e a e e lo e a us rs c n b c rta o thetyp o d ta c nta d in nd e a e e in f e f a o ine ag n c lum ive o n.  It a o s p sd tava a n. ls im lifie a lid tio  Be a e a va s a fro the s m d m in, the c us ll lue re m a e o a d m in c n b d fine a e rc d w the Da o a a e e d nd nfo e ith ta Definitio La ua e(DDL) o thed ta a es ftw re n ng g f a bs o a .
  32. 32.  This p p rty s te tha the o e ro e ta s t rd ring o the c lum in f o ns there tio l ta leha no m a la na b s e ning .  C lum c n b re ve in a o e a in va us o ns a e trie d ny rd r nd rio s q nc s e ue e .  It e b s m ny us rs to s re the s m ta le w ut na le a e ha a e b itho c nc rn o ho theta leiso a d o e f w b rg nize .  It a o p rm the p ic l s ture o the d ta a e to ls e its hys a truc f a bs c ng w ut a c ha e itho ffe tingthere tio l ta le . la na b s
  33. 33.  This p p rty is a lo o the o a o b a p s to ro e na g us ne b ve ut p lie ro sins a o c lum . w te d f o ns  Ad inginfo a n to are tio l ta leiss p d a d rm tio la na b im lifie nd d e no a c e tingq rie . o s t ffe t xis ue s  Ad inginfo a n to are tio l ta leiss p d a d rm tio la na b im lifie nd d e no a c e tingq rie . o s t ffe t xis ue s
  34. 34.  Be a e the s q nc o c lum is ins nific nt, c us e ue e f o ns ig a c lum m t b re re e b na e a no b o ns us e fe nc d y m nd t y  p so n. n na e ne d no b uniq w o itio A c lum m e t e ue ithin a e n ntire d ta a eb o w a b s ut nly ithin theta letow h it b lo s b hic e ng .
  35. 35. Example of Relational Model
  36. 36.  An o je t-re tio l b c la na d ta a e (ORD), o o je t- a bs r b c re tio l d ta a e m na e e s te (ORDBMS), is la na a b s a g m nt ys m a d ta a e m na e e s te (DBMS) s ila to a a b s a g m nt ys m im r re tio l d ta a e la na a b s  An o je t-o nte d ta a e m d l: o je ts c s e a b c rie d a b s o e b c , la s s nd inhe nc a d c s p rte in d ta a e s he a rita e re ire tly up o d a b s c ms a in theq ry la ua e nd ue ng g .  It s p rts e ns n o the d ta m d l w c to up o xte io f a o e ith us m d ta e a m tho s a -typ s nd e d .
  37. 37.  An o je t-re tio l d ta a e c n b s id to p vid a b c la na a b s a e a ro e m d g und b tw e re tio l d ta a e a o je t- id le ro e e n la na a b s s nd b c o nte d ta a e (OODBMS). rie d a b s s  In o je t-re tio l d ta a e , thea p a h ise s ntia b c la na a b s s p ro c s e lly tha o re tio l d ta a e : the d ta re id s in the t f la na a b s s a s e d ta a e a is m nip te c lle tive w q rie in a b s nd a ula d o c ly ith ue s aq ry la ua e ue ng g ;  a the o r e m a OODBMSe in w h the t the xtre e re s hic d ta a e is e s ntia a p rs te o je t s re fo a bs s e lly e is nt b c to r s ftw re w n in a o je t-o nte p g m ing o a ritte n b c rie d ro ra m la ua e w a p g m ing AP fo s ring a ng g , ith ro ra m I r to nd re ving o je ts a little o no s e ific s p rt fo trie b c , nd r pc up o r q rying ue .
  38. 38. Example of Object-Relational Model
  39. 39. In c m uting o je t m d l ha tw re te b d tinc o p , b c o e s o la d ut is t ma e ning : s 1. The p p rtie o o je ts in g ne l, in a s e ific ro e s f b c e ra pc c m ute p g m ing la ua e te hno g no tio o p r ro ra m ng g , c lo y, ta n o m tho o g tha us s the . Fo e m le the J va r e d lo y t e m r xa p , a o je t m d l, the C b c oe OM o je t m d l, o the o je t b c oe r b c m d l o OMT. Suc o je t m d ls a us lly d fine oe f h b c o e re ua e d us ing c nc p s h a c s , m s a e inhe nc , o e ts uc s la s e s g , rita e p lym rp m a e a s tio The is a e ns o o his , nd nc p ula n. re n xte ive lite tureo fo a d o je t m d ls a a s s t o the ra n rm lize b c o e s ub e f fo a s m ntic o p g m ingla ua e . rm l e a s f ro ra m ng g s
  40. 40. 2 A c lle tio o o je ts o c s e thro h w h a . o c n f b c r la s s ug hic p g m cn e m ro ra a xa ine a m nip te s m s e ific nd a ula o e p c p rts o its w rld In o r w rd , the o je t-o nte a f o . the o s b c rie d inte c to s m s rvic o s te . Suc a inte c is rfa e o e e e r ys m h n rfa e s id to b theo je t m d l o there re e d s rvic o a e b c oe f p s nte e e r s te . Fo e m le the Do um nt Ob c Mo e ys m r xa p , c e je t dl (DOM) isac lle tio o o je tstha re re e ap g in o c n f b c t p s nt a e a w b b w e us d b s rip p g m to e m a e ro s r, e y c t ro ra s xa ine nd d m a c ng thep g . The isaMic s ft Exc l yna ic lly ha e ae re ro o e o je t m d l fo c ntro b c oe r o lling Mic s ft Exc l fro ro o e m a the p g m a the ASC no r ro ra , nd OM Te s o e Drive is le c p r a o je t m d l fo c ntro n b c oe r o lling a a tro m a n s no ic l te s o e le c p .
  41. 41. Example of Object Model for Paint Application
  42. 42.  The Entity-Re tio hip (ER) m d l w s o ina la ns o e a rig lly p p s d b P te in 19 [C n76 a a w y to unify ro o e y e r 76 he ] s a thene o a re tio l d ta a evie s tw rk nd la na a b s w  ER m d l isa c nc p l d ta m d l tha vie sthere l oe o e tua a oe t w a w rld a e o s ntitie a re tio hip . s nd la ns s  A b s c m o nt o the m d l is the Entity- a ic o p ne f oe Re tio hip d g mw h isus d to vis lly re re e la ns ia ra hic e ua p s nt d tao je ts a b c .
  43. 43.  It m p w ll to there tio l m d l. Thec ns tsus d as e la na o e o truc e in the ER m d l c n e s o e a a ily b tra fo e into e ns rm d re tio l ta le . la na b s  It is s p a e s to und rs nd w a m im le nd a y e ta ith inim o um f training The fo , the m d l c n b us d b the . re re oe a e e y d ta a e d s ne to c m unic te the d s n to the e a b s e ig r o m a e ig nd us r. e  In a d n, the m d l c n b us d a a d s n p n b d itio o e a e e s e ig la y the d ta a e d ve p r to im le e a d ta m d l in a b s e lo e p m nt a oe s e ificd ta a em na e e s ftw re pc a b s a g m nt o a .
  44. 44. The ER m d l vie s the re l w rld a a c ns t o oe w a o s o truc f entitie a a s c tio b tw e e s nd s o ia n e e n ntitie . s 1. Entities 2 Special Entity Types . 3 Attributes . 4 Relationships . 5 Classifying Relationships . 6 Degree of a Relationship . 7. Connectivity and Cardinality 8 Direction .
  45. 45. 9 Type . 10 Existence . 11. Generalization Hierarchies 12 ER Notation .
  46. 46.  Entitie a the p ip l d ta o je t a o w h s re rinc a a b c b ut hic info a n isto b c lle te . rm tio e o c d  Entitie a us lly re o niza le c nc p , e r s re ua cg b o e ts ithe c nc te o a s c s h a p rs n, p c s thing , o o re r b tra t, uc s e o la e , s r e ntsw h ha re va eto thed ta a e ve hic ve le nc a bs.  Entitie a c s ifie a ind p nd nt o d p nd nt (in s re la s d s e e e r e e e s m m tho o g s the te s us d a s ng a o e e d lo ie , rm e re tro nd w a re p c ly). e k, s e tive  An ind p nd nt e ee e ntity is o tha d e no re o ne t o s t ly n a the fo id ntific tio no r r e a n.  A d p nd nt e e e e ntity is o tha re s o a the fo ne t lie n no r r id ntific tio e a n.
  47. 47.  An entity o c nc (a o c lle a ins nc ) is a c urre e ls a d n ta e n ind ua o c nc o a e ivid l c urre e f n ntity.  An o c nc is a lo o to a ro in the re tio l c urre e na g us w la na ta le b .
  48. 48.  As o ia s c tive entitie (a o kno n a inte e tio e s ls w s rs c n ntitie ) s a e re ntitie us d to a s c te tw o m re e s e s o ia o r o ntitie ins o e to re o ileam ny-to a re tio hip rd r c nc a -m ny la ns .  Sub e e typ s ntitie a us d in g ne liza n hie rc s s re e e ra tio ra hie to re re e a s s t o ins nc s o the p re e p s nt ub e f ta e f ir a nt ntity, c lle the s e e b w h ha a ute o a d up rtyp , ut hic ve ttrib s r re tio hip tha a p o tothes s t. la ns s t p ly nly ub e
  49. 49.  A Re tio hip re re e a a s c tio b tw e tw o la ns p s nts n s o ia n e e n o r m ree o ntitie . s  An e m leo are tio hipw uld b : xa p f la ns o e e p ye sa a s ne top je ts m lo e re s ig d ro c p je tsha s ta ks ro c ve ub s d p rtm ntsm na eo o m rep je ts ea e a g ne r o ro c  Re tio hip a c s ifie in te so d g e la ns s re la s d rm f e re , c nne tivity, c rd lity, a e te e o c a ina nd xis nc .
  50. 50.  Attrib s d s rib the e ute e c e ntity o w h the a f hic y re a s c te . s o ia d  A p rtic r ins nc o a a uteisava . a ula ta e f n ttrib lue  Fo e m le "J ne R. Ha w y" is o va o the r xa p , a tha a ne lue f a uteNa e ttrib m.  The d m in o a a ute is the c lle tio o a o a f n ttrib o c n f ll p s ib va s a a ute c n ha . The d m in o o s le lue n ttrib a ve o a f Na eisac ra te s m ha c r tring.  Attrib sc n b c s ifie a id ntifie o d s rip rs ute a e la s d s e rs r e c to .
  51. 51.  Id ntifie , m re c m o e rs o o m nly c lle ke , uniq ly a d ys ue id ntify a ins nc o a e e n ta e f n ntity.  A d s rip r d s rib s a no e c to e c e n-uniq c ra te tic o a ue ha c ris f n entity ins nc . ta e
  52. 52.  Re tio hip la ns s are c s ifie la s d b y the ir d g e e re , c nne tivity, c rd lity, d c n, typ , a e te e o c a ina ire tio e nd xis nc .  No a t ll m d ling m tho o g s us a oe e d lo ie e ll the e s c s ific tio . la s a ns
  53. 53.  The d g e o a re tio hip is the num e o e e re f la ns b r f ntities a s c te w there tio hip s o ia d ith la ns .  Then-a re tio hip istheg ne l fo fo d g en. ry la ns e ra rm r e re  Sp c l c s s a the b ry, a te ry, w re the e ia a e re ina nd rna he d g eis2 a 3 re p c ly. e re , nd , s e tive  Bina ry re tio hip , the a s c tio b tw e tw la ns s s o ia n e e n o entitie isthem s c m o typ in there l w rld s ot o mn e a o .  A re urs b ry re tio hip o c w n a e c ive ina la ns c urs he n ntity is re te to its lf. An e m lem ht b "s m e p ye s la d e xa p ig e o e m lo e a m rrie to o r e p ye s re a d the m lo e ".
  54. 54.  A te ry re tio hip invo s thre e rna la ns lve e ntitie a is us d s nd e w n ab ry re tio hipisina e ua . he ina la ns d q te  Many m d ling a p a he re o nize o oe p ro c s c g nly b ry ina re tio hip . la ns s  Te ry o n-a re tio hip a d c m o e into tw rna r ry la ns s re e o p s d o o m reb ry re tio hip . r o ina la ns s
  55. 55.  Thec nne tivity o are tio hip d s rib sthem p ing o c f la ns ec e ap o a s c te e f s o ia d ntity ins nc sin there tio hip ta e la ns .  Theva so c nne tivity a "o " o "m ny". lue f o c re ne r a  The c rd lity o a re tio hip is the a tua num e o a ina f la ns c l br f re te o c nc sfo e c o thetw e la d c urre e r a h f o ntitie . s  Theb s typ s o c nne tivity fo re tio a : o -to a ic e f o c r la ns re ne - o , o -to a a m ny-to a ne ne -m ny, nd a -m ny.  A one-to-one (1:1) re tio hip is w n a m s o la ns he t o t ne ins nc o a e ta e f ntity A is a s c te w o ins nc o s o ia d ith ne ta e f entity B. Fo e m le "e p ye s in the c m a a r xa p , m lo e o p ny re e c a s ne the o n o e Fo e c e p ye the a h s ig d ir w ffic . r a h m lo e re e ts a uniq o e a fo e c o e the e ts a xis ue ffic nd r a h ffic re xis uniq e p ye . ue m lo e
  56. 56.  A one-to-many (1:N) re tio hip isw n fo o la ns s he r ne ins nc o e ta e f ntity A, the a ze , o , o m ny re re ro ne r a ins nc so e ta e f ntity B, b fo o ins nc o e ut r ne ta e f ntity B, the iso o ins nc o e re nly ne ta e f ntity A. An e m leo a xa p f 1:N re tio hip is la ns s ad p rtm nt ha m ny e p ye s ea e s a m lo e e c e p ye isa s ne to o d p rtm nt a h m lo e s ig d ne e a e
  57. 57.  A many-to-many (M:N) re tio hip s m tim sc lle la ns , o e e a d no p c , isw n fo o ins nc o e n-s e ific he r ne ta e f ntity A, the re a ze , o , o m ny ins nc so e re ro ne r a ta e f ntity B a fo o nd r ne ins nc o e ta e f ntity B the a ze , o , o m ny re re ro ne r a ins nc so e ta e f ntity A. An e m leis xa p : e p ye sc n b a s ne tono m retha tw m lo e a e s ig d o n o p je tsa thes m tim ; ro c t a e e p je tsm t ha a s ne a le s thre ro c us ve s ig d t a t e e p ye s m lo e
  58. 58.  The d c n o a re tio hip ind a s the o ina ire tio f la ns ic te rig ting entity o ab ry re tio hip f ina la ns .  The entity fro w h a re tio hip o ina s is the m hic la ns rig te p re e a nt ntity; the e ntity w re the re tio hip he la ns te ina sisthec rm te hild entity.  The d c n o a re tio hip is d te ine b its ire tio f la ns e rm d y c nne tivity. o c  In a o -to ne re tio hip the d c n is fro the ne -o la ns ire tio m ind p nd nt e e e e ntity to ad p nd nt e e e e ntity.
  59. 59.  If b th e o ntitie a ind p nd nt, thed c n isa itra s re e e e ire tio rb ry. W ith o -to a re tio hip , the e ne -m ny la ns s ntity o c c urring o eisthep re nc a nt.  Thed c n o m ny-to a re tio hip isa itra ire tio f a -m ny la ns s rb ry.
  60. 60.  An id ntifying re tio hip is o in w h o o the e la ns ne hic ne f childentitie isa oad p nd nt e s ls e e e ntity.  A no e n-id ntifying re tio hip is o in w h b th la ns ne hic o entitie a ind p nd nt. s re e e e
  61. 61.  Exis nc d no s w the the e te e o a e te e e te he r xis nc f n ntity ins nc is d p nd nt up n the e te e o a the ta e ee e o xis nc f no r, re te , e la d ntity ins nc . ta e  Thee te eo a e xis nc f n ntity in a re tio hip is d fine a la ns e d s e r m nd to o o tio l. ithe a a ry r p na  If a ins nc o a e n ta e f n ntity m t a a o c fo a us lw ys c ur r n entity to b inc e in a re tio hip the it is e lud d la ns , n m nd to An e m le o m nd to e te e is the a a ry. xa p f a a ry xis nc s te e "e ry p je t m t b m na e b a s le ta m nt ve ro c us e a g d y ing d p rtm nt". ea e
  62. 62.  If theins nc o thee ta e f ntity isno re uire , it iso tio l. t q d p na An e m le o o tio l e te e is the s te e xa p f p na xis nc ta m nt, "e p ye sm y b a s ne tow rk o p je ts m lo e a e s ig d o n ro c ".
  63. 63.  A g ne liza n hie rc is a fo o a s c n tha e ra tio ra hy rm f b tra tio t s e ifie tha tw o m re e p c s t o r o ntitie tha s re c m o s t ha o m n a ute c n b g ne lize into a hig r le l e ttrib s a e e ra d he ve ntity typ c lle as e eo g ne e e a d up rtyp r e ric ntity.  The lo e ve o e w r-le l f ntitie b c m the s typ , o s eo e ub e r c te o s to the s e e Sub e a d p nd nt a g rie , up rtyp . typ s re e e e entitie . s  Ge ra tio o c ne liza n c urs w n tw o m re e he o r o ntities re re e c te o so thes m re l-w rld o je t. p s nt a g rie f a e a o b c
  64. 64.  Fo e m le W g s r xa p , a e _Em lo e a p ye s nd C s ifie _Em lo e re re e c te o so thes m la s d p ye s p s nt a g rie f a e entity, Em lo e . In thise m le Em lo e w uld b p ye s xa p , p ye s o e thes e e W g s up rtyp ; a e _Em lo e a p ye s nd C s ifie _Em lo e w uldb thes typ s la s d p ye s o e ub e .  Sub e c n b e r m typ s a e ithe utua e lus (d jo lly xc ive is int) or o rla p (inc ive ve p ing lus ).  Amutua e lus c te o isw n a e lly xc ive a g ry he n ntity ins nc ta e c n b in o o c te o a e nly ne a g ry.  An o rla p c te o isw n a e ve p ing a g ry he n ntity ins nc m y ta e a b in tw o m re s typ s An e m le w uld b a e o r o ub e . xa p o e p rs n w w rks fo a unive ity c uld a o b a e o ho o r rs o ls e s e a tha s m unive ity. tud nt t t a e rs
  65. 65.  Thec m le ne sc ns int re uire tha a ins nc s o p te s o tra q s t ll ta e o thes typ b re re e d in thes e e f ub e e p s nte up rtyp .  Ge ra tio hie rc s c n b ne te . Tha is a ne liza n ra hie a e s d t , s typ o o hie rc c n b a s e e o a the ub e f ne ra hy a e up rtyp f no r. The le l o ne ting is lim d o b the c ns int o ve f s ite nly y o tra f s p ity. Sub ee im lic typ ntitie m y b thep re e s a e a nt ntity in a re tio hipb no thec . la ns ut t hild
  66. 66.  The is no s nd rd fo re re e re ta a r p s nting d ta o je ts in ER a b c d g m . Ea h m d ling m tho o g us s its o n ia ra s c oe e d lo y e w no tio ta n.  The o ina no tio us d b C n is w e us d in rig l ta n e y he id ly e a a e ic te a jo c d m s xts nd urna b ra ly s e in e r ls ut re e n ithe C ASE to lso p lic tio b no c d m s o r ub a ns y n-a a e ic .  To a the a a num e o no tio us d a o the d y, re re b r f ta ns e ; m ng m rec m o a Ba hm n, c w fo t, a IDEFIX. o o m n re c a ro 's o nd  All no tio l s s re re e e ta na tyle p s nt ntitie a re ta ula s s c ng r b xe a re tio hip a line c nne tingb xe . o s nd la ns s s s o c o s
  67. 67.  Ea h s c tyle us s a s e ia s t o s b ls to re re e the e p c l e f ym o p s nt c rd lity o ac nne tio a ina f o c n.
  68. 68.  Thes b lsus d fo theb s ER c ns tsa : ym o e r a ic o truc re 1. Entities a re re e d b la e d re ta le . Thela e re p s nte y b le c ng s bl is the na e o the e m f ntity. Entity na e s uld b m s ho e s ula no . ing r uns 2 Relationships a re re e d b as lid linec nne ting . re p s nte y o o c tw e o ntitie . The na e o the re tio hip is w n s m f la ns ritte a o theline Re tio hipna e s uld b ve s b ve . la ns m s ho e rb . 3 Attributes, w n inc e , a lis d ins e the e . he lud d re te id ntity re ta le Attrib s w h a c ng . ute hic re id ntifie e rs a re und rline . Attrib na e s uld b s ula no . e d ute m s ho e ing r uns
  69. 69. 4 Cardinality o m ny is re re e d b a line e ing in . f a p s nte y nd a c w fo t. If the c w fo t is o itte , the ro 's o ro 's o m d c rd lity iso . a ina ne 5 Existence is re re e d b p c . p s nte y la ing a c le o a irc r p rp nd ula b r o the line Ma a ry e te e is e e ic r a n . nd to xis nc s w b the b r (lo ks like a 1) ne to the e ho n y a o xt ntity for a ins nc is re uire . Op na e te e is s w b n ta e q d tio l xis nc ho n y p c ac lene tothee la ing irc xt ntity tha iso tio l. t p na
  70. 70. Exa p o ER No tio m le f ta n

×