Learn Data Modelling PDF

download Learn Data Modelling PDF

of 112

Transcript of Learn Data Modelling PDF

  • 8/12/2019 Learn Data Modelling PDF

    1/112

    Williams | Learn Data Modeling by Example - Part 1 1

    Learn Data M odelling

    by Example

    Barry Williams

  • 8/12/2019 Learn Data Modelling PDF

    2/112

    Williams | Learn Data Modeling by Example - Part 1 2

    Part 1 - Table of Contents

    Part 1 - Table of Contents

    Wel!ome

    1 Data Modeling at Windsor Castle in England

    2 Data Modeling in Denmar#

    " Data Modeling in T%r#ey

    ' (ome Basi! Con!epts

    ) + Database for a ,ideo ame

    First Edition: London, 2011

    ISBN-13: 978-1466237414

  • 8/12/2019 Learn Data Modelling PDF

    3/112

    Williams | Learn Data Modeling by Example - Part 1 "

    WelcomeThis is Part 1 o o!r "oo# has "$$n %rod!&$d in r$s%ons$ to a n!'"$r o r$(!$sts ro')isitors to o!r *ata"as$ +ns $rs $" Sit$.

    It is int$nd$d or "$/inn$rs to *ata od$ in/

    It in&or%orat$s a s$ $&tion ro' o!r Li"rar o a"o!t 9 0 data 'od$ s that ar$ $at!r$d ono!r $" sit$:

    htt%: .data"as$ans $rs.or/ data5'od$ s ind$ .ht'

    I ho%$ o! $n o this Boo# and o! d "$ )$r % $as$d to ha)$ o!r &o''$nts at"arr data"as$ans $rs.or/ .

    Barr i ia'sPrin&i%a ons! tant

    *ata"as$ +ns $rs Ltd.London, En/ and

    1. Data Modeling at Windsor Castle in England

    1.1 Introduction

    This irst ha%t$r is a t!toria on data 'od$ in/ or o!n/ %$o% $. It %ro)id$s an introd!&tionto data 'od$ in/ that $ ho%$ o! ind int$r$stin/ and $as to r$ad.

    It &o)$rs th$ "asi& &on&$%ts and has a )$r !s$r- ri$nd a%%roa&h, $at!rin/ a t$dd "$arand #itt$n &r$atin/ a data 'od$ on a tri% as to!rists to indsor ast $, hi&h is !sto!tsid$ London, En/ and.

    o! &an ind this &ha%t$r as a t!toria on th$ *ata"as$ +ns $rs $" sit$:

    htt%: .data"as$ans $rs.or/ t!toria 45data5 'od$ in/5di'% $5and5to" 5)isit5 indsor5&ast $ ind$ .ht'

    In this t!toria , $ i o o t o o!n/ to!rists as th$ )isit indsor ast $ and &r$at$ adata 'od$ .

    ;!r to!rists ar$ *i'% $, a 10- $ar-o d /ir , ho i#$s si/hts$$in/ and i&$ &r$a'and To" , *i'% $

  • 8/12/2019 Learn Data Modelling PDF

    4/112

  • 8/12/2019 Learn Data Modelling PDF

    5/112

    Williams | Learn Data Modeling by Example - Part 1 )

    1.1.2 Wh is it im!ortant?

    *ata 'od$ in/ is i'%ortant "$&a!s$ it is th$ o!ndation or so 'an a&ti)iti$s:

    It %ro)id$s a )$hi& $ or &o''!ni&ation a'on/ a id$ )ari$t o int$r$st$d %arti$s,in& !din/ 'ana/$'$nt, d$)$ o%$rs, data ana sts, *B+s and 'or$.

    + %h si&a data"as$ &an $asi "$ /$n$rat$d ro' a data 'od$ !sin/ a &o''$r&iadata 'od$ in/ too .

    1.1." What Will I #earn?

    o! i $arn:

    =o to &r$at$ a data 'od$ , startin/ ro' s&rat&h.

    hat a t %i&a data 'od$ oo#s i#$.

    1.2 To!ics

    In this &ha%t$r, $ i &o)$r so'$ "asi& &on&$%ts in data 'od$ in/:

    Pri'ar and For$i/n >$ s

    ;n$-to- an and an -to- an ?$ ationshi%s

    =i$rar&hi$s and Inh$ritan&$

    ?$ $r$n&$ *ata

    1." #et$s go to Windsor

    @*i'% $A: To" , it

  • 8/12/2019 Learn Data Modelling PDF

    6/112

  • 8/12/2019 Learn Data Modelling PDF

    7/112

    Williams | Learn Data Modeling by Example - Part 1 /

    @To" A: ;>. L$tin/do' i)$s

    To" and *i'% $ $a)$ London and arri)$ at indsor

    1.% &rri'ing at Windsor@*i'% $A o , To" , indsor has a "$a!ti ! &ast $ and h$r$ is a ro a %ar# ith ots od$$r.

  • 8/12/2019 Learn Data Modelling PDF

    8/112

    Williams | Learn Data Modeling by Example - Part 1 *

    @To" A $s, *i'% $, and h$n $ oo# aro!nd th$r$ ar$ so 'an "an#s, &a $s, %!"s,r$sta!rants, sho%s, in$ "ars and hos%ita sG

    Th$ oth$r thin/ that $ s$$ h$n $ oo# aro!nd is %$o% $ - ots o %$o% $.

    So $ &an start thin#in/ a"o!t o!r data 'od$ .

    1.( )tarting our Data Model

    @*i'% $A: =o do $ /$t start$dC

    @To" A: $ , $ #no that $ ha)$ %$o% $ and % a&$s.Th$ si'% $st start is to &a a th$s$ % a&$s establishments .Th$n $ si'% ha)$ di $r$nt #inds o $sta" ish'$nts.

    +nd $ ha)$ %$o% $ - o&a %$o% $, to!rists, st!d$nts, %$o% $ %assin/ thro!/h, %$o% $or#in/ h$r$, %$o% $ h$r$ on "!sin$ss and so on.

    @*i'% $A: =''' - so ho do $ trans at$ hat $ #no to h$ % !s /$t start$d ith o!rdata 'od$ C

    @To" A: L$tHs start a dia/ra' ith %$o% $ and $sta" ish'$nts.

    This si'% $ dia/ra' is /oin/ to /ro into a data 'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    9/112

    Williams | Learn Data Modeling by Example - Part 1 $

    1.* Identifiers and Primar +e s@*i'% $A: To" , I a' on$ o th$s$ %$o% $ so ho do I &r$at$ a !ni(!$ id$ntit or ' s$ to'a#$ '$ di $r$nt ro' $)$r "od $ s$C

    @To" A: $ i /i)$ $)$r %$rson a uni,ue identifier and $)$r $sta" ish'$nt its o n!ni(!$ Id$nti i$r.

    h$n $ !s$ th$s$ $ &a th$' Primar +e s , and sho th$' in th$ dia/ra' ith a P+on th$ $ t-hand sid$.

    @*i'% $A: That so!nds /ood, To" , "!t I don

  • 8/12/2019 Learn Data Modelling PDF

    10/112

    Williams | Learn Data Modeling by Example - Part 1 1&

    To 'a#$ it $asi$r or o! to !nd$rstand I ha)$ $ %and$d th$ man -to-man relationshi!into t o di $r$nt thin/s, hi&h ar$ &a $d one-to-man relationshi!s .

    @*i'% $A: So To" , is that i#$ sa in/ that on$ %$rson &an 'a#$ 'an )isits to 'an$sta" ish'$ntsC

    @To" A: $s, *i'% $ - that

  • 8/12/2019 Learn Data Modelling PDF

    11/112

    Williams | Learn Data Modeling by Example - Part 1 11

    Th$n th$ P$rson5I* i$ d "$&o'$s a in# to a r$&ord or a %$rson in th$ P$rson Ta" $.This in# is hat is &a $d a /oreign +e and $ &an s$$ it.E)$r thin/ that $ "! is &a $d a !roduct , and a $ ha)$ to do is si'% d$ in$ th$ t %$o $a&h %rod!&t - s!&h as a &o $$, '! in or a n$ s%a%$r.

    Th$n $ dra a itt $ "o &a $d Products and sa that $)$r %rod!&t has a t %$.In oth$r ords, th$r$ is a r$ ationshi% "$t $$n th$ Products and Product_Types "o $s.

    Th$ in$s ar$ &a $d relationshi!s and th$ ar$ )$r i'%ortant in data 'od$ in/.$ ar$ no &r$atin/ an Entit -?$ ationshi% *ia/ra' or E?* .

    This dia/ra' sho s on a in$ or th$ r$ ationshi%:

    Th$ s '"o at th$ %rod!&ts $nd is &a $d crows feet and it sho s th$ many $nd.

    Th$ short strai/ht in$ at th$ Prod!&t5T %$s $nd sho s th$ one $nd.

    In oth$r ords, this in$ sho s a on$-to-'an r$ ationshi%.

  • 8/12/2019 Learn Data Modelling PDF

    12/112

    Williams | Learn Data Modeling by Example - Part 1 12

    *i'% $, $t '$ $ % ain a"o!t th$ dott$d in$. It '$ans that th$ r$ ationshi% r$s! ts in a KFor$i/n >$ H in th$ %rod!&ts ta" $. This is sho n " th$ KF>H s '"o n$ t to th$ product_type_code i$ d and it '$ans that th$r$ is a in# "a to th$ Prod!&t5T %$s.

    =o $)$r, th$ %ri'ar #$ is on th$ Prod!&t5I*, and o &o!rs$, this is sho n " th$ KP>Hs '"o n$ t to th$ Product3ID i$ d.

    Lat$r, h$n $ ta # a"o!t inh$ritan&$, $ i !s$ a strai/ht in$, in &ontrast to this dott$din$ h$r$. This is to sho that th$ or$i/n #$ i$ d is a so a %ri'ar #$ .

    I ha)$ to sa so'$thin/ a "it di i&! t a"o!t %ri'ar #$ s ri/ht no .

    In th$ Prod!&ts Ta" $, $ ha)$ to a o or a )$r ar/$ n!'"$r o %rod!&ts "$in/ stor$d.

    Th$r$ or$ $ !s$ an I* i$ d or th$ %ri'ar #$ .

    $ th$n &r$at$ this I* i$ d a!to'ati&a as a n!'"$r &a $d an a!to-in&r$'$nt int$/$rJ.

    This n!'"$r has no '$anin/ and is si'% !s$d to id$nti $a&h r$&ord !ni(!$ a'on/%ossi" 'i ions or h!ndr$ds o 'i ions.

    =o $)$r, thin/s ar$ di $r$nt or Kt %$H i$ ds.

    Th$s$ ar$ hat $ &a $n!'$rat$d data and ar$ t %i&a reference data .

    Th$ ar$ a a s r$ ati)$ s'a in n!'"$r and $ &hoos$ a &od$ or th$ %ri'ar #$"$&a!s$ $ &an &r$at$ th$' and r$)i$ th$' 'an!a .

    It a so h$ %s !s to &r$at$ a &od$ that $ &an !s$ and r$ $r to, in &ontrast to th$ I* i$ dsthat ha)$ no '$anin/.

    T %i&a $ a'% $s o! d "$:

    Si $s O S'a , $di!' and Lar/$ h$r$ $ ar$ a&&!sto'$d to s$$in/ S, and L.

    $nd$r O a $ and F$'a $, h$r$ $ !s$ and F.

  • 8/12/2019 Learn Data Modelling PDF

    13/112

    Williams | Learn Data Modeling by Example - Part 1 1"

    This '$n! "oard at Star"!s sho s ots o %rod!&ts.

    $ #no that th$ ar$ or/ani $d in /ro!%s, i#$ ood and drin#, and $a&h o th$s$ has 'or$/ro!%s and so on, ri/ht do n to th$ %arti&! ar %rod!&t, i#$ &ara'$ 'a&&hiato or a %anini.

    This to%-do n or/ani ation is &a $d a hierarch and a%%$ars a o)$r th$ % a&$.

    L!i $ &an sho this )$r $asi and n$at in o!r data 'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    14/112

    Williams | Learn Data Modeling by Example - Part 1 1'

    1.4 Products5 T !es and Product 6ierarchies@*i'% $A: To" , h$n $ oo# & os$ at th$ '$n! "oard to tr to d$&id$ hat to ord$r $&an s$$ ots o %ossi"i iti$s. B!t a t$r a hi $ $ &an s$$ a %att$rn that h$ %s !s d$&id$.=o do $ d$a ith a that in o!r itt $ data 'od$ C

    @To" A: $ *i'% $, it

  • 8/12/2019 Learn Data Modelling PDF

    15/112

    Williams | Learn Data Modeling by Example - Part 1 1)

    1.17 T !es of Peo!le@*i'% $A: To" , that oo#s ;>.I /!$ss $ &an d$a ith t %$s o %$o% $ th$ sa'$ a , &an $C

    @To" A: $s, *i'% $, and t %$s o $sta" ish'$nts as $ .

    @*i'% $A: ;>, that so!nds s$nsi" $. +nd do th$ !s$ th$s$ id$nti i$rs in a data"as$C

    @To" A: $s, and hat is $)$n "$tt$r is that th$ data"as$ i a!to'ati&a /$n$rat$ a n$!ni(!$ Id$nti i$r or o! and o!r )isits and %!r&has$s i o! ant to /$t a r$ !nd at$r.

    1.11 T !es of Peo!le and Establishments@*i'% $A: I s$$, To" .I /!$ss $ &an d$a ith t %$s o $sta" ish'$nts th$ sa'$ a , &an $C

    @To" A: $s, *i'% $.

    @*i'% $A: ;>, that so!nds s$nsi" $. +nd do th$ !s$ th$s$ id$nti i$rs in a data"as$C

    @To" A: $s, and $ &an !s$ o!r n$ !ni(!$ id$nti i$r or o! and o!r )isits and %!r&has$sin &as$ $ ant to #$$% tra o thin/s.

    Li#$ 'a "$ o! ant to /$t a r$ !nd at$r so $ n$$d to /$t o!r d$tai s ro' th$data"as$.

  • 8/12/2019 Learn Data Modelling PDF

    16/112

  • 8/12/2019 Learn Data Modelling PDF

    17/112

    Williams | Learn Data Modeling by Example - Part 1 1/

    1.12 8isits and Purchases9=$r$ $ &an s$$ 'an )isitors to indsorHs ?o a Sho%%in/ +r&ad$.

    @*i'% $A: To" , ith so 'an %$o% $, $sta" ish'$nts and %!r&has$s ho do th$ #$$%tra o $)$r thin/C

    @To" A: $ , *i'% $, " this ti'$, $)$r thin/ has its o n id$nti i$r that is !s$d h$r$)$rth$ n$$d to #$$% tra.

    @*i'% $A: ;>, that so!nds s$nsi" $. +nd do th$ !s$ th$s$ id$nti i$rs in a data"as$C

  • 8/12/2019 Learn Data Modelling PDF

    18/112

    Williams | Learn Data Modeling by Example - Part 1 1*

    @To" A: $s, *i'% $, and in this dia/ra', $ &an s$$ that $ &an !s$ th$ !ni(!$ id$nti i$rsthat ar$ sho n as KP>,H or Pri'ar >$ s.

    $ &an s$$ that $ ha)$ a P> or $)$r $ntit or ta" $ so $ &an "$ %r$tt s!r$ $ &an /$tro' an ta" $ to an oth$r ta" $.

    This is &a $d navigating aro!nd th$ data 'od$ and is a /ood t$st or a $ -d$si/n$d data'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    19/112

    Williams | Learn Data Modeling by Example - Part 1 1$

    1.1" Peo!le and Inheritance@To" A: *i'% $, $t, To" . I %ro'is$ to do that.

    @To" A: $ a r$ad said that $ ha)$ o&a %$o% $ and to!rists.

    Th$r$ ar$ a a s ots and ots o %$o% $ )isitin/ indsor ast $.

    h$n $ oo# at this %i&t!r$, $ &an s$$ &$r$'onia /!ards in &$r$'onia r$d !ni or's, anda "i/ &ro d, ith 'ain to!rists "!t a so sta in sho%s r$s%onsi" $ or &ontro in/ th$&ro d, to!rists, o&a %$o% $ and so on.

    So'$ o th$s$ o&a %$o% $ ar$ sho%%$rs and so'$ o th$' i "$ or#in/ in th$ sho%s.$ i &a th$ or#$rs staff and $ #no di $r$nt thin/s a"o!t th$' than th$ thin/s $

    #no a"o!t th$ to!rists.

    For $ a'% $, $ i %ro"a" #no th$ /$nd$r o $)$r "od !st " oo#in/ at th$'.For sta , $ i !s!a a so #no th$ir dat$ o "irth and th$ir ho'$ addr$ss.

  • 8/12/2019 Learn Data Modelling PDF

    20/112

  • 8/12/2019 Learn Data Modelling PDF

    21/112

    Williams | Learn Data Modeling by Example - Part 1 21

    $ &an s$$ a i$ d 'ar#$d as K P/$ in th$ thr$$ ta" $s or &$r$'onia /!ards, sta andto!rists.

    This is !n!s!a "$&a!s$ it '$ans a i$ d that is a P ri'ar >$ in th$ thr$$ ta" $s and a so a/ or$i/n >$ to th$ P$o% $ Ta" $.

    Th$r$ or$, i o!r irst r$&ord as a &$r$'onia /!ard, th$n $ o! d ha)$ a r$&ord in th$P$o% $ Ta" $ ith a P$rson5I* o 1 and a r$&ord in th$ &$r$'onia /!ard ith a !ard5I* o1.

    Si'i ar , i o!r s$&ond r$&ord as a '$'"$r o sta , $ o! d ha)$ a r$&ord in th$ P$o% $Ta" $ ith a P$rson5I* o 2 and a r$&ord in th$ Sta Ta" $ ith a Sta 5I* o 3.

    1.1% )taff5 Establishments and Deri'ed /ields@*i'% $A: To" , ho do $ s%$&i that sta '!st or# in so'$ $sta" ish'$ntC

    @To" A: *i'% $, that

  • 8/12/2019 Learn Data Modelling PDF

    22/112

  • 8/12/2019 Learn Data Modelling PDF

    23/112

    Williams | Learn Data Modeling by Example - Part 1 2"

    @*i'% $A: I, To" . *o o! thin# I i !nd$rstand itC

    @To" A: L$t '$ h$ % o! " 'a#in/ a ist o th$ business rules or o!r 'od$ :

    P$o% $ &an "$ $ith$r &$r$'onia /!ards, sta or to!rists.

    Th$r$ ar$ a n!'"$r o $sta" ish'$nts o di $r$nt t %$s.

    To!rists &an 'a#$ )isits to $sta" ish'$nts and 'a#$ %!r&has$s.

    Sta assist th$ to!rists h$n th$ 'a#$ a %!r&has$.

    + %!r&has$ in)o )$s on$ %rod!&t.

    @To" A: ;>, *i'% $ - $ ha)$ a )$r ni&$ data 'od$ and no $ &an ta#$ th$ "r$a# I%ro'is$d o!.

    @*i'% $A: That

  • 8/12/2019 Learn Data Modelling PDF

    24/112

    Williams | Learn Data Modeling by Example - Part 1 2'

    It$ to th$ P$o% $ Ta" $.

    @*i'% $A: =''', I, *i'% $. o!

  • 8/12/2019 Learn Data Modelling PDF

    25/112

    Williams | Learn Data Modeling by Example - Part 1 2)

  • 8/12/2019 Learn Data Modelling PDF

    26/112

    Williams | Learn Data Modeling by Example - Part 1 2.

    1.1 To!-#e'el Model ;ith +e /ieldsThis is hat o!r data 'od$ oo#s i#$ i $ sho #$ i$ ds on and $a)$ o!t th$?$ $r$n&$ *ata Ta" $s.

    This $)$ o dis% a is s!ita" $ i $ ant to &on ir' to $a&h oth$r ho th$ ta" $s or$ntiti$sJ ar$ r$ at$d.

  • 8/12/2019 Learn Data Modelling PDF

    27/112

    Williams | Learn Data Modeling by Example - Part 1 2/

    1.14 To!-#e'el Model ;ith all Details

    Fina , this is hat o!r data 'od$ oo#s i#$ i $ sho th$ #$ i$ ds, a th$ data it$'son and th$ ?$ $r$n&$ *ata Ta" $s.

    o! &an s$$ that th$ a'o!nt o d$tai in)o )$d 'a#$s it 'or$ di i&! t to !nd$rstand hatHs/oin/ on and to id$nti hat is i'%ortant.

    This $)$ o dis% a is s!ita" $ i $ ant to ta # a"o!t d$tai s and d$)$ o% a data"as$ ro'o!r data 'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    28/112

    Williams | Learn Data Modeling by Example - Part 1 2*

    1.27 Ice Cream@To" A: *i'% $, I

  • 8/12/2019 Learn Data Modelling PDF

    29/112

    Williams | Learn Data Modeling by Example - Part 1 2$

    2. Data Modeling in Denmar0

    Fr$d$ri#s"or/ ast $ in *$n'ar#

    $ ha)$ 'o)$d this ha%t$r to a s$%arat$ do&!'$nt that o! &an do n oad h$r$ :- htt%: .data"as$ans $rs.or/ do n oads ha%t$r525L$arn5*ata5 od$ in/5Boo#5 or5*$n'ar#.%d

    http://www.databaseanswers.org/downloads/Chapter_2_Learn_Data_Modelling_Book_for_Denmark.pdfhttp://www.databaseanswers.org/downloads/Chapter_2_Learn_Data_Modelling_Book_for_Denmark.pdfhttp://www.databaseanswers.org/downloads/Chapter_2_Learn_Data_Modelling_Book_for_Denmark.pdf
  • 8/12/2019 Learn Data Modelling PDF

    30/112

    Williams | Learn Data Modeling by Example - Part 1 "&

    ". Data Modeling in Tur0e

    ".1 IntroductionIn this t!toria , $ i o o t o o!n/ to!rists as th$ )isit T!r#$ , hi&h is a &o!ntr

    ith a tr$'$ndo!s histor and )$r %o%! ar ith to!rists oo#in/ or so'$thin/ s%$&ia .

    ;!r to!rists ar$ *i'% $, a 10- $ar o d /ir , ho i#$s si/hts$$in/ and i&$ &r$a'and To" , *i'% $

  • 8/12/2019 Learn Data Modelling PDF

    31/112

    Williams | Learn Data Modeling by Example - Part 1 "1

    It %ro)id$s a )$hi& $ or &o''!ni&ation a'on/ a id$ )ari$t o int$r$st$d %arti$s,in& !din/ 'ana/$'$nt, d$)$ o%$rs, data ana sts, *B+s and 'or$.

    + %h si&a data"as$ &an $asi "$ /$n$rat$d ro' a data 'od$ !sin/ a &o''$r&iadata 'od$ in/ too .

    ".1." What Will I #earn?o! i $arn:

    =o to &r$at$ a data 'od$ , startin/ ro' s&rat&h

    Th$ i'%ortant d$si/n %rin&i% $s in)o )$d

    hat a t %i&a data 'od$ oo#s i#$

    ".2 To!ics

    In this &ha%t$r, $ i &o)$r so'$ "asi& &on&$%ts in data 'od$ in/: Pri'ar and For$i/n >$ s

    ;n$-to- an and an -to- an ?$ ationshi%s

    =i$rar&hi$s and Inh$ritan&$

    ?$ $r$n&$ *ata

    "." #et$s get started

    @To" A: $ ha)$ !st arri)$d in T!r#$ . hat o! d o! i#$ to do toda C

    @*i'% $A: To" , It

  • 8/12/2019 Learn Data Modelling PDF

    32/112

    Williams | Learn Data Modeling by Example - Part 1 "2

    @To" A: ;>. L$t

  • 8/12/2019 Learn Data Modelling PDF

    33/112

    Williams | Learn Data Modeling by Example - Part 1 ""

    ".% &rri'ing at Istanbul@*i'% $A o , To" , oo# at a th$s$ %$o% $.

    @To" A $s, *i'% $, h$n $ oo# aro!nd th$r$ ar$ so 'an %$o% $, sho%s, "an#s and soonG

    So $ &an start thin#in/ a"o!t o!r data 'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    34/112

    Williams | Learn Data Modeling by Example - Part 1 "'

    ".( )tarting our Data Model

    @*i'% $A: =o do $ /$t start$dC

    @To" A: $ , $ #no that $ ha)$ %$o% $ and % a&$s.Th$ si'% $st start is to &a a th$s$ % a&$s establishments .Th$n $ si'% ha)$ di $r$nt #inds o $sta" ish'$nts.

    +nd $ ha)$ %$o% $ - o&a %$o% $, to!rists, st!d$nts, %$o% $ %assin/ thro!/h, %$o% $or#in/ h$r$, %$o% $ h$r$ on "!sin$ss and so on.

    @*i'% $A: =''' - so ho do $ trans at$ hat $ #no to h$ % !s /$t start$d ith o!rdata 'od$ C

    @To" A: L$tHs start a dia/ra' ith %$o% $ and $sta" ish'$nts.

    This si'% $ dia/ra' is /oin/ to /ro into a data 'od$ .

    ".* Identifiers and Primar +e s@*i'% $A: To" , I a' on$ o th$s$ %$o% $ so ho do I &r$at$ a !ni(!$ id$ntit or ' s$ to'a#$ '$ di $r$nt ro' $)$r "od $ s$C

    @To" A: $ i /i)$ $)$r %$rson a uni,ue identifier and $)$r $sta" ish'$nt its o n!ni(!$ id$nti i$r.

    h$n $ !s$ th$s$ $ &a th$' Primar +e s , and sho th$' in th$ dia/ra' ith a P+on th$ $ t-hand sid$.

    @*i'% $A: That so!nds /ood, To" , "!t I don

  • 8/12/2019 Learn Data Modelling PDF

    35/112

    Williams | Learn Data Modeling by Example - Part 1 ")

    $ ha)$ 'ana/$d to ind a (!i$t ar$a h$r$ a )$r ha%% 'an is s$ in/ a T!r#ish a)orit$,&a $d SI IT 0J

    So, in oth$r ords, $ ha)$ on$ %$rson, ho is th$ ha%% 'an, and on$ $sta" ish'$nt,hi&h is his si'% $ sta .

    So $ &an &r$at$ a %$o% $ r$&ord ith a %$rson I* o 1 and an $sta" ish'$nts r$&ord or th$sta , ith an $sta" ish'$nt I* o 3.

    ". elationshi!s and /oreign +e s@To" A: *i'% $, no $ &an add so'$ int$r$stin/ d$tai s "$&a!s$ $ #no that on$ %$rson&an )isit 'an $sta" ish'$nts.

    $ a so #no that on$ $sta" ish'$nt is )isit$d " 'an to!rists.Th$n $ &a this a man -to-man relationshi! "$t $$n %$o% $ and $sta" ish'$nts.

    To 'a#$ it $asi$r or o! to !nd$rstand I ha)$ $ %and$d th$ man -to-man relationshi!into t o di $r$nt thin/s, hi&h ar$ &a $d one-to-man relationshi!s .

    @*i'% $A: So To" , is that i#$ sa in/ that on$ %$rson &an 'a#$ 'an )isits to 'an$sta" ish'$ntsC

  • 8/12/2019 Learn Data Modelling PDF

    36/112

    Williams | Learn Data Modeling by Example - Part 1 ".

    @To" A: $s, *i'% $ - that

  • 8/12/2019 Learn Data Modelling PDF

    37/112

    Williams | Learn Data Modeling by Example - Part 1 "/

    ". Products and Product T !es@*i'% $A: To" , h$n $ /o into a sho% $ ant to "! so'$thin/.+nd th$r$ ar$ tho!sands and tho!sands o %ossi"i iti$s.=o do $ d$a ith a that in o!r itt $ data 'od$ C

    @To" A: $ *i'% $, it

  • 8/12/2019 Learn Data Modelling PDF

    38/112

    Williams | Learn Data Modeling by Example - Part 1 "*

    *i'% $, $t '$ $ % ain a"o!t th$ dott$d in$. It '$ans that th$ r$ ationshi% r$s! ts in aor$i/n #$ in th$ Prod!&ts Ta" $. This is sho n " th$ KF>H s '"o n$ t to th$

    product_type_code i$ d and it '$ans that th$r$ is a in# "a to th$ Prod!&t5T %$s.

    =o $)$r, th$ %ri'ar #$ is on th$ Prod!&t5I*, and o &o!rs$, this is sho n " th$ KP>Hs '"o n$ t to th$ Product3ID i$ d.

    Lat$r, h$n $ ta # a"o!t inh$ritan&$, $ i !s$ a strai/ht in$, in &ontrast to this dott$din$ h$r$. This is to sho that th$ or$i/n #$ i$ d is a so a %ri'ar #$ .

    I ha)$ to sa so'$thin/ a "it di i&! t a"o!t %ri'ar #$ s ri/ht no .

    In th$ Prod!&ts Ta" $, $ ha)$ to a o or a )$r ar/$ n!'"$r o %rod!&ts "$in/ stor$d.

    Th$r$ or$ $ !s$ an I* i$ d or th$ Pri'ar #$ .

    $ th$n &r$at$ this I* i$ d a!to'ati&a as a n!'"$r &a $d an a!to-in&r$'$nt int$/$rJ.

    This n!'"$r has no '$anin/ and is si'% !s$d to id$nti $a&h r$&ord !ni(!$ a'on/%ossi" 'i ions or h!ndr$ds o 'i ions.

    =o $)$r, thin/s ar$ di $r$nt or t !e i$ ds.

    Th$s$ ar$ hat $ &a $n!'$rat$d data and ar$ t %i&a r$ $r$n&$ data.

    Th$ ar$ a a s r$ ati)$ s'a in n!'"$r and $ &hoos$ a &od$ or th$ %ri'ar #$"$&a!s$ $ &an &r$at$ th$' and r$)i$ th$' 'an!a .

    It a so h$ %s !s to &r$at$ a &od$ that $ &an !s$ and r$ $r to, in &ontrast to th$ I* i$ dsthat ha)$ no '$anin/.

    T %i&a $ a'% $s o! d "$:

    Si $s O S'a , $di!' and Lar/$ h$r$ $ ar$ a&&!sto'$d to s$$in/ S, and L.

    $nd$r O a $ and F$'a $, h$r$ $ !s$ , F and or n#no n.

  • 8/12/2019 Learn Data Modelling PDF

    39/112

    Williams | Learn Data Modeling by Example - Part 1 "$

    This '$n! "oard sho s a t %i&a '$n! in a T!r#ish r$sta!rant that s$r)$s a id$ran/$ o ood and drin#.

    $ &an s$$ that th$ ar$ or/ani $d in /ro!%s, i#$ d$ss$rts and hot and &o d drin#s, and$a&h o th$s$ has %rod!&ts, i#$ a%% $ "a# a)a or t!r#ish &o $$.

    This to%-do n or/ani ation is &a $d a hierarch and a%%$ars a o)$r th$ % a&$ in o!ror d.

    L!i $ &an sho this )$r $asi and n$at in o!r data 'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    40/112

    Williams | Learn Data Modeling by Example - Part 1 '&

    ".4 Products5 T !es and Product 6ierarchies@*i'% $A: To" , h$n $ oo# & os$ at th$ '$n! to tr to d$&id$ hat to ord$r $ &an s$$

    ots o %ossi"i iti$s

    B!t a t$r a hi $ $ &an s$$ a %att$rn that h$ %s !s d$&id$.=o do $ d$a ith a that in o!r itt $ data 'od$ C

    @To" A: $ *i'% $, it

  • 8/12/2019 Learn Data Modelling PDF

    41/112

    Williams | Learn Data Modeling by Example - Part 1 '1

    @*i'% $A: I thin# I !nd$rstand that, it so!nds ;>.

    @To" A: Fina , $ sho this hi$rar&h " a dott$d in$ in th$ to%-ri/ht hand &orn$r in th$$ntit &a $d

  • 8/12/2019 Learn Data Modelling PDF

    42/112

    Williams | Learn Data Modeling by Example - Part 1 '2

    ".17 T !es of Peo!le@*i'% $A: To" , that oo#s ;>.I /!$ss $ &an d$a ith t %$s o %$o% $ th$ sa'$ a , &an $C

    @To" A: $s, *i'% $, and t %$s o $sta" ish'$nts as $ .

    @*i'% $A: ;>, that so!nds s$nsi" $. +nd do th$ !s$ th$s$ id$nti i$rs in a data"as$C

    @To" A: $s, and hat is $)$n "$tt$r is that th$ data"as$ i a!to'ati&a /$n$rat$ a n$!ni(!$ id$nti i$r or o! and o!r )isits and %!r&has$s i o! ant to /$t a r$ !nd at$r.

    ".11 T !es of Peo!le and Establishments@*i'% $A: To" , that oo#s ;>.I /!$ss $ &an d$a ith t %$s o $sta" ish'$nts th$ sa'$ a , &an $C

    @To" A: $s, *i'% $.

    @*i'% $A: ;>, that so!nds s$nsi" $. +nd do th$ !s$ th$s$ id$nti i$rs in a data"as$C

    @To" A: $s, and $ &an !s$ o!r n$ !ni(!$ id$nti i$r or o! and o!r )isits and %!r&has$sin &as$ $ ant to #$$% tra o thin/s.

    Li#$ 'a "$ o! ant to /$t a r$ !nd at$r so $ n$$d to /$t o!r d$tai s ro' th$data"as$.

  • 8/12/2019 Learn Data Modelling PDF

    43/112

    Williams | Learn Data Modeling by Example - Part 1 '"

    @To" A: B$ or$ $ 'o)$ on, $t

  • 8/12/2019 Learn Data Modelling PDF

    44/112

    Williams | Learn Data Modeling by Example - Part 1 ''

    @*i'% $A: To" , ith so 'an to!rists, sta s, sho%s and thin/s to "! , ho do $ #$$%tra o $)$r thin/C

    @To" A: $ , *i'% $, " this ti'$, $)$r thin/ has its o n id$nti i$r that is !s$d h$r$)$rth$ n$$d to #$$% tra.

    @*i'% $A: ;>, that so!nds s$nsi" $. +nd do $ !s$ th$s$ id$nti i$rs in a data"as$C

    @To" A: $s, *i'% $, and in this dia/ra', $ &an s$$ that $ &an !s$ th$ !ni(!$ id$nti i$rsthat ar$ sho n as KP>,H or %ri'ar #$ s.

    $ &an s$$ that $ ha)$ a P> or $)$r $ntit or ta" $ so $ &an "$ %r$tt s!r$ $ &an /$tro' an ta" $ to an oth$r ta" $.

    This is &a $d navigating aro!nd th$ data 'od$ and is a /ood t$st or a $ -d$si/n$d data'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    45/112

    Williams | Learn Data Modeling by Example - Part 1 ')

    ".1" Peo!le and Inheritance@To" A: *i'% $, $t

  • 8/12/2019 Learn Data Modelling PDF

    46/112

    Williams | Learn Data Modeling by Example - Part 1 '.

    In data 'od$ in/ $ ha)$ a )$r %o $r ! a%%roa&h that $ &a Inheritance that $ &an!s$ h$r$.

    I $ ant to d$s&ri"$ this in En/ ish, $ o! d sa that sta inh$rit th$ P$o% $5T %$5 od$and /$nd$r ro' th$ %ar$nt $ntit o %$o% $, and in addition, th$ ha)$ a dat$ o "irth andho'$ addr$ss.

    For to!rists, $ donHt #no '!&h, $ &$%t or th$ dat$ o th$ir )isit, and 'a "$, i th$ "!so'$thin/ in a sho% !sin/ a &r$dit &ard, th$n th$ sho% o! d #no th$ &r$dit &ard d$tai s.

    *o$s that 'a#$ s$ns$, *i'% $C

    @*i'% $A: I thin# so, To" .Is it i#$ sa in/ that $ inh$rit ha)in/ t o ar's and t o $/s ro' o!r %ar$nts "$&a!s$ th$

    ha)$ t o ar's and t o $/s, "!t that $ ha)$ a so ha)$ thin/s that ar$ !st !sC

    @To" A: $s, *i'% $ - that

  • 8/12/2019 Learn Data Modelling PDF

    47/112

    Williams | Learn Data Modeling by Example - Part 1 '/

    $ &an s$$ a i$ d 'ar#$d as KPFH in th$ ta" $s or sta and to!rists.

    This is !n!s!a "$&a!s$ it '$ans a i$ d that is a P ri'ar >$ in th$ thr$$ ta" $s and a so a/ or$i/n >$ to th$ P$o% $ Ta" $.

    Th$r$ or$, i o!r irst r$&ord as a '$'"$r o sta , th$n $ o! d ha)$ a r$&ord in th$P$o% $ Ta" $ ith a P$rson5I* o 1 and a r$&ord in th$ sta ta" $ ith a Sta 5I* o 3.

    Si'i ar , i o!r s$&ond r$&ord as a to!rist, $ o! d ha)$ a r$&ord in th$ P$rson Ta" $ith a P$rson5I* o 2 and a r$&ord in th$ to!rist ta" $ ith a Sta 5I* o 3.

    ".1% )taff5 Establishments and Deri'ed /ields@*i'% $A: To" , ho do $ s%$&i that sta '!st or# in so'$ $sta" ish'$ntC

    @To" A: *i'% $, that

  • 8/12/2019 Learn Data Modelling PDF

    48/112

  • 8/12/2019 Learn Data Modelling PDF

    49/112

    Williams | Learn Data Modeling by Example - Part 1 '$

    @To" A: P$o% $ 'a#$ r$s$r)ations $)$r da a aro!nd th$ or d.

    Th$s$ r$s$r)ations ha)$ a ot in &o''on:

    =ot$ "oo#in/s, air in$ "oo#in/s, th$atr$s and sho s, a%%oint'$nts to s$$ a do&toror d$ntist and so on.

    Th$ "asi& &o''on thin/s ar$ a dat$ and ti'$, !s!a a s%$&i i& a&i it , i#$ a hot$ ,an air in$ s$at, a th$atr$ and so on.

    This '$ans that $ &an id$nti hat th$ ha)$ in &o''on and hat th$ ha)$ that isdi $r$nt and s%$&i i& to th$ t %$ o a%%oint'$nt.

  • 8/12/2019 Learn Data Modelling PDF

    50/112

    Williams | Learn Data Modeling by Example - Part 1 )&

    ".12.1 eser'ations for a 6otel=$r$ is a )$r "$a!ti ! and !ni(!$ hot$ in th$ &a)$s at !na# E) $ri a"o!t 400 #' ro'Istan"! J, hi&h has roo's datin/ "a to th$ th &$nt!r .

    For a hot$ , o &o!rs$, o! o! d "oo# or a s%$&i i& ni/ht or ni/htJ and 'a "$ a non-s'o#in/ roo' "!t that is a"o!t a .

    6otel in the Ca'es at una0 E'leri5 Tur0e

  • 8/12/2019 Learn Data Modelling PDF

    51/112

  • 8/12/2019 Learn Data Modelling PDF

    52/112

    Williams | Learn Data Modeling by Example - Part 1 )2

    ".1* eference Data@To" A: *i'% $, o! &an s$$ that I a' !sin/ a $nd$r Ta" $ and P$o% $ T %$s Ta" $.I ha)$ /i)$n th$' "oth na'$s that "$/in ith

  • 8/12/2019 Learn Data Modelling PDF

    53/112

    Williams | Learn Data Modeling by Example - Part 1 )"

    ".1 :ringing it all Together@To" A: *i'% $, i $ "rin/ to/$th$r $)$r thin/ $ ha)$ ta #$d a"o!t, $ i s$$ that $ha)$ (!it$ a /ood data 'od$ that an %ro $ssiona o! d "$ %ro!d o .

    @*i'% $A: ;>, To" . *o o! thin# I i !nd$rstand itC

    @To" A: L$t '$ h$ % o! " 'a#in/ a ist o th$ business rules or o!r 'od$ :

    P$o% $ &an "$ $ith$r sta or to!rists.

    Th$r$ ar$ a n!'"$r o $sta" ish'$nts o di $r$nt t %$s.

    To!rists &an 'a#$ )isits to $sta" ish'$nts and 'a#$ %!r&has$s.

    Sta assist th$ to!rists h$n th$ 'a#$ a %!r&has$.

    + %!r&has$ in)o )$s on$ or 'or$ %rod!&ts.

    @To" A: ;>, *i'% $ - $ ha)$ a )$r ni&$ data 'od$ and no $ &an ta#$ th$ "r$a# I%ro'is$d o!.

    @*i'% $A: That$ in th$ StaTa" $ and a / or$i/n >$ to th$ P$o% $ Ta" $.

    @*i'% $A: =''', I

  • 8/12/2019 Learn Data Modelling PDF

    54/112

    Williams | Learn Data Modeling by Example - Part 1 )'

    @To" A: ;>, *i'% $. o!

  • 8/12/2019 Learn Data Modelling PDF

    55/112

    Williams | Learn Data Modeling by Example - Part 1 ))

    ".14 To!-#e'el Model ;ith +e /ieldsThis is hat o!r data 'od$ oo#s i#$ i $ sho >$ i$ ds on and $a)$ o!t th$?$ $r$n&$ *ata Ta" $s.

    This $)$ o dis% a is s!ita" $ i $ ant to &on ir' to $a&h oth$r ho th$ ta" $s or$ntiti$sJ ar$ r$ at$d.

  • 8/12/2019 Learn Data Modelling PDF

    56/112

    Williams | Learn Data Modeling by Example - Part 1 ).

    ".27 To!-#e'el Model ;ith all DetailsFina , this is hat o!r data 'od$ oo#s i#$ i $ sho th$ #$ i$ ds, a th$ data it$'son and 'ost o th$ ?$ $r$n&$ *ata Ta" $s.

    o! &an s$$ that th$ a'o!nt o d$tai in)o )$d 'a#$s it 'or$ di i&! t to !nd$rstand hatHs/oin/ on and to id$nti hat is i'%ortant.

    This $)$ o dis% a is s!ita" $ i $ ant to ta # a"o!t d$tai s and d$)$ o% a data"as$ ro'o!r data 'od$ .

  • 8/12/2019 Learn Data Modelling PDF

    57/112

    Williams | Learn Data Modeling by Example - Part 1 )/

    ".21 )tarbuc0s@To" A: *i'% $, I

  • 8/12/2019 Learn Data Modelling PDF

    58/112

    Williams | Learn Data Modeling by Example - Part 1 )*

    @*i'% $A: I

  • 8/12/2019 Learn Data Modelling PDF

    59/112

    Williams | Learn Data Modeling by Example - Part 1 )$

    This 'at$ria is a so a)ai a" $ as a t!toria or +'a on and Star"!s on th$ *ata"as$+ns $rs $" sit$ O

    htt%: .data"as$ans $rs.or/ t!toria 45data5 'od$ in/ ind$ .ht'

    $ i &o)$r th$s$ "asi& &on&$%ts:

    a. r$atin/ Entiti$s

    ". Pri'ar and For$i/n >$ s

    &. ;n$-to- an and an -to- an ?$ ationshi%s

    d. =i$rar&hi$s

    $. Inh$ritan&$

    . ?$ $r$n&$ *ata

    +t th$ $nd o this t!toria , $ i ha)$ %rod!&$d a data 'od$ , hi&h is &o''on r$ $rr$das an Entit -?$ ationshi% *ia/ra', or

  • 8/12/2019 Learn Data Modelling PDF

    60/112

    Williams | Learn Data Modeling by Example - Part 1 .&

    %.1." What Will I #earn?

    o! i $arn:

    =o to &r$at$ a data 'od$ , startin/ ro' s&rat&h.

    hat a t %i&a data 'od$ oo#s i#$.

    %.2 What is the )co!e?

    ;!r %hoto sho s a t %i&a Star"!s. I $ oo# & os$ , $ &an s$$ %$o% $ $atin/, drin#in/and % a&in/ ord$rs. hat Star"!s s$$s ar$ &!sto'$rs, %rod!&ts and ord$rs "$in/ '$t.

    *!rin/ th$ &o!rs$ o this "oo# $ i s$$ ho data 'od$ s &an h$ % to "rid/$ this /a% in%$r&$%tion and &o''!ni&ation.

    >etting )tarted9 Th$ ar$a $ ha)$ &hos$n or this t!toria is a data 'od$ or a si'% $ =rder Processing) stem or Star"!s.

    $ ha)$ don$ it this a "$&a!s$ 'an %$o% $ ar$ a'i iar ith Star"!s and it %ro)id$san a%% i&ation that is $as to r$ at$ to.

  • 8/12/2019 Learn Data Modelling PDF

    61/112

  • 8/12/2019 Learn Data Modelling PDF

    62/112

    Williams | Learn Data Modeling by Example - Part 1 .2

    =$r$ is a ist o 'od$ in/ too s on th$ *ata"as$ +ns $rs $" sit$:

    htt%: .data"as$ans $rs.or/ 'od$ in/5too s.ht'

    This is ho o! &r$at$ an $ntit in th$ *$ i/n data 'od$ in/ too :1. ?i/ht-& i on a " an# ar$a in th$ dia/ra'4. Fro' th$ dro%-do n ist, &hoos$ nsert and !ntity 3. h$ th$ PK "o or th$ %ri'ar #$ attri"!t$, hi&h i !s!a "$ th$ irst on$ on th$$ntit .7. i on "lose to sa)$ th$ r$s! ts.

    %.( Primar +e s$ d$&id$ that th$ thin/s $ ar$ int$r$st$d in ar$ &!sto'$rs, ord$rs and %rod!&ts.

    o! &an "! a ran/$ o %rod!&ts in Star"!s, in& !din/ so!)$nir '!/s, &o $$ andn$ s%a%$rs.

    For th$ %!r%os$ o o!r irst 'od$ , $ r$stri&t o!r %rod!&ts to ood and drin#.

    This dia/ra' sho s th$ &orr$s%ondin/ $ntiti$s ith %ri'ar #$ s.

    http://www.databaseanswers.org/modelling_tools.htmhttp://www.databaseanswers.org/modelling_tools.htm
  • 8/12/2019 Learn Data Modelling PDF

    63/112

    Williams | Learn Data Modeling by Example - Part 1 ."

    1. +t this sta/$, $ sho on th$ $ntiti$s ith no r$ ationshi%s and 'ini'!'attri"!t$s and s%$&i on th$ %ri'ar #$ and on$ details i$ d that i "$r$% a&$d at$r on.

    2. Th$ Primary Key i$ d sJ sho! d a a s "$ irst.3. o! i noti&$ that th$ irst i$ d in th$ !sto'$rs5)$rsion2 Ta" $ is th$

    !sto'$r5I*.4. It has a PK s '"o "$sid$ it, hi&h indi&at$s that it is th$ %ri'ar #$ or th$

    ta" $.

    . Th$ %ri'ar #$ is )$r i'%ortant and is th$ a that $ &an r$&o/ni $ $a&hindi)id!a r$&ord in th$ ta" $.

    r$atin/ a %ri'ar #$ in th$ *$ i/n too :1. ?i/ht-& i on th$ !ntity 3. hoos$ #ttri$utes 6. h$ th$ PK "o or th$ %ri'ar #$ attri"!t$, hi&h i !s!a "$ th$ irst on$on th$ $ntit .

    7. i on "lose to sa)$ th$ r$s! ts.

    %.* /oreign +e sThis dia/ra' sho s $ntiti$s ith or$i/n #$ s.

    !sto'$r5I* is a or$i/n #$ that in#s ord$rs to &!sto'$rs.

  • 8/12/2019 Learn Data Modelling PDF

    64/112

    Williams | Learn Data Modeling by Example - Part 1 .'

    =$r$ $ ha)$ add$d th$ relationshi!s "$t $$n th$ $ntiti$s.

    h$n this %ri'ar #$ is !s$d in anoth$r ta" $, it is r$ $rr$d to as a foreign key .

    $ &an s$$ a /ood $ a'% $ in this dia/ra', h$r$ th$ !sto'$r5I* a%%$ars in th$;rd$rs Ta" $ as a or$i/n #$ .

    This is sho n ith an < s '"o "$sid$ it.

    Mandator +e /ields

    + or$i/n #$ is !s!a mandator . For $ a'% $, a )a !$ or a !sto'$r5I* in th$!sto'$rs5Pa '$nt5 $thods Ta" $ '!st &orr$s%ond to an a&t!a )a !$ o th$!sto'$r5I* in th$ !sto'$rs5M$rsion51 Ta" $. This is sho n in th$ dia/ra' " th$

    short strai/ht in$ at th$ $nd o th$ dott$d in$ & os$ to th$ !sto'$rs Ta" $.

    /oreign +e s in the DeAign ToolFor$i/n #$ s ar$ &r$at$d a!to'ati&a h$n o! 'a#$ a r$ ationshi% "$t $$n t o $ntiti$s.

    $ r$&o''$nd that o! 'o)$ th$ i$ d !% in th$ $ntit so that it ta#$s it % a&$a %ha"$ti&a a'on/ th$ #$ i$ ds.

    To do this, ri/ht-& i on th$ $ntit , &hoos$ th$ #ttri$utes o%tion, th$n & i on th$ !% ordo n arro on th$ ri/ht-hand sid$.

    %. =ne-to-Man elationshi!s

  • 8/12/2019 Learn Data Modelling PDF

    65/112

    Williams | Learn Data Modeling by Example - Part 1 .)

    In this dia/ra', a &!sto'$r &an % a&$ $ro, on$ or 'an ord$rs.This d$ in$s a on$-to-'an r$ ationshi%.

    This is sho n " th$ s '"o that has thr$$ s'a in$s at that $nd o th$ r$ ationshi%dott$d in$, hi&h is r$ $rr$d to as crow%s feet .

    =!tional +e /ields

    Stri&t s%$a#in/, a &!sto'$r do$s not ha)$ to % a&$ an ord$r. =$ or sh$ &o! d &han/$th$ir 'ind and a # o!t itho!t ord$rin/ an thin/. In oth$r ords, $ o! d sa thatth$ r$ ationshi% is o!tional at th$ ord$rs $nd. This is sho n " th$ itt $ & at that $nd oth$ r$ ationshi% dott$d in$.

    + data 'od$ $r o! d sa QFor $)$r &!sto'$r, th$r$ &an "$ $ro, on$ or 'an ord$rsR.

    TE M DE/I

  • 8/12/2019 Learn Data Modelling PDF

    66/112

    Williams | Learn Data Modeling by Example - Part 1 ..

    !sto'$r +n !nit that &an rais$ a d$'and.

    *$'and + r$(!$st or ass$ts to "$ s!%% i$d.

    Th$ or'at o a r$(!$st &an "$ an $ $&troni& '$ssa/$, a %a%$r or' and soon.

    B!sin$ss ?! $s: + &!sto'$r &an rais$ $ro, on$ or 'an d$'ands.

    : + d$'and '!st "$ asso&iat$d ith a )a id &!sto'$r.

    %. Man -to-Man elationshi!s

    This dia/ra' sho s a 'an -to-'an r$ ationshi% "$t $$n ord$rs and %rod!&ts.

    +n ord$r &an in& !d$ 'an %rod!&ts and a %rod!&t &an a%%$ar on 'an ord$rs.

    This d$ in$s a 'an -to-'an r$ ationshi% and is sho n in a data 'od$ as o o s:

    + 'an -to-'an r$ ationshi% &annot "$ i'% $'$nt$d in r$ ationa data"as$s.

    Th$r$ or$ $ r$so )$ this 'an -to-'an into t o on$-to-'an r$ ationshi%s, hi&h $sho in a data 'od$ as o o s:

    So'$ti'$s it is !s$ ! to s$$ th$ #$ i$ ds to $ns!r$ that $)$r thin/ oo#s a ri/ht.

  • 8/12/2019 Learn Data Modelling PDF

    67/112

    Williams | Learn Data Modeling by Example - Part 1 ./

    h$n $ oo# & os$ at this data 'od$ , $ &an s$$ that th$ %ri'ar #$ is &o'%os$d oth$ ;rd$r5I* and Prod!&t5I* i$ ds.

    This r$ $&ts th$ !nd$r in/ o/i&, hi&h stat$s that $)$r &o'"ination o ord$r and %rod!&tis !ni(!$.

    In th$ data"as$, this i d$ in$ a n$ r$&ord.

    h$n $ s$$ this sit!ation in a data"as$, $ &an sa that this r$ $&ts a 'an -to-'an

    r$ ationshi%.

    =o $)$r, $ &an a so sho th$ sa'$ sit!ation in a s i/ht di $r$nt a , hi&h r$ $&ts th$standard d$si/n a%%roa&h o !sin/ a s!rro/at$ #$ as th$ %ri'ar #$ and sho in/ th$d$'and and %rod!&t I*s si'% as or$i/n #$ s.

  • 8/12/2019 Learn Data Modelling PDF

    68/112

  • 8/12/2019 Learn Data Modelling PDF

    69/112

    Williams | Learn Data Modeling by Example - Part 1 .$

    TE M DE/I

  • 8/12/2019 Learn Data Modelling PDF

    70/112

    Williams | Learn Data Modeling by Example - Part 1 /&

    This dia/ra' sho s ho th$ hi$rar&hi$s o %rod!&ts and %rod!&t t %$s that $ ha)$ !stdis&!ss$d ar$ sho n in o!r Entit - elationshi! Diagram .

    o! i noti&$ that th$ ta" $ &a $d

  • 8/12/2019 Learn Data Modelling PDF

    71/112

    Williams | Learn Data Modeling by Example - Part 1 /1

    S&hoo ana/$'$nt S st$'s Shr$# 2 o)i$ Train/ an! a&t!r$d It$'s Tra)$ To!ris' or d id$

    M$hi& $ I'%orts

    &n EBam!le in the Militar

    $ start ith th$ d$ inition o a nit, hi&h at its si'% $st, oo#s i#$ this:

    In this &as$, $ !s$ a '$anin/ $ss I* or th$ !nit I* hi&h is si'% a !ni(!$ n!'"$r.

    .

    Th$n $ thin# a"o!t th$ a&t that $)$r !nit is %art o a ar/$r or/ani ation.

    In oth$r ords, $)$r !nit r$%orts to a hi/h$r $)$ ithin th$ o)$ra or/ani ation.

    Fort!nat$ , $ &an sho this in a )$r si'% $ and $&ono'i&a ashion " &r$atin/ ar$ ationshi% that adds a %ar$nt I* to $)$r !nit.

    This is a&&o'% ish$d " addin/ a r$ ationshi% that oins th$ ta" $ to its$ .

    This is or'a &a $d a reflexive or recursive r$ ationshi%, and in or'a &a $d ra$$it ears ,and oo#s i#$ this:

    http://www.databaseanswers.org/data_models/school_management_systems/index.htmhttp://www.databaseanswers.org/data_models/shrek_2_movie/index.htmhttp://www.databaseanswers.org/data_models/tracking_manufactured_items/index.htmhttp://www.databaseanswers.org/data_models/travel_and_tourism_worldwide/index.htmhttp://www.databaseanswers.org/data_models/vehicle_imports/index.htmhttp://www.databaseanswers.org/data_models/school_management_systems/index.htmhttp://www.databaseanswers.org/data_models/shrek_2_movie/index.htmhttp://www.databaseanswers.org/data_models/tracking_manufactured_items/index.htmhttp://www.databaseanswers.org/data_models/travel_and_tourism_worldwide/index.htmhttp://www.databaseanswers.org/data_models/vehicle_imports/index.htm
  • 8/12/2019 Learn Data Modelling PDF

    72/112

    Williams | Learn Data Modeling by Example - Part 1 /2

    Th$ !nit at th$ )$r to% o or/ani ation has no on$ to r$%ort to, and a !nit at th$ o $st$)$ do$s not ha)$ an oth$r !nit r$%ortin/ to it.

    In oth$r ords, this r$ ationshi% is o!tional at th$ to% and "otto' $)$ s.

    $ sho this " th$ s'a $tt$r & at $a&h $nd o th$ in$ that 'ar#s th$ r$ ationshi%.

  • 8/12/2019 Learn Data Modelling PDF

    73/112

    Williams | Learn Data Modeling by Example - Part 1 /"

    %.17 Inheritance

    Inh$ritan&$ is a )$r %o $r ! t$&hni(!$. It a o s !s to 'od$ &o'% $ sit!ations in a'ann$r and st $ that is )$r si'% $.

    In this sit!ation, $ ar$ thin#in/ a"o!t KFood and *rin#H.

    KFood and *rin#H ar$ s%$&i i& $ a'% $s o th$ 'or$ /$n$ra thin/ &a $d a product .Th$ inh$rit &o''on attri"!t$s ro' th$ %rod!&t, and a so ha)$ so'$ o th$ir o n.For $ a'% $, KFoodH &an &ontain KN!tsH "!t K*rin#H 'a not &ontain KN!ts,H "!t "oth ha)$ a

    %rod!&t na'$.

    Th$ !n!s!a s '"o in th$ 'idd $ o th$ dia/ra', &o'%os$d o a &ir& $ ith t o s'a in$s!nd$rn$ath it is ho inheritance is sho n !sin/ th$ *$ i/n data 'od$ in/ too .

    Inh$ritan&$ is a )$r i'%ortant to%i& h$n o! ar$ &r$atin/ a data 'od$ . In % ain En/ ish,$ o! d sa that inh$ritan&$ o&&!rs h$r$ a Par$nt- hi d r$ ationshi% $ ists "$t $$n

    thin/s o int$r$st or $ntiti$sJ.

  • 8/12/2019 Learn Data Modelling PDF

    74/112

    Williams | Learn Data Modeling by Example - Part 1 /'

    o! &an as# th$ si'% $ Is-a (!$stion - in this &as$, i $ as#

  • 8/12/2019 Learn Data Modelling PDF

    75/112

    Williams | Learn Data Modeling by Example - Part 1 /)

    In a si'i ar a , h$n $ dis&!ss air&ra t $ 'i/ht "$ ta #in/ a"o!t rotar air&ra t, i $din/ air&ra t and !n'ann$d air&ra t.

    =o $)$r, h$n $ ant to d$si/n or r$)i$ a data 'od$ that in& !d$s air&ra t, th$n $

    n$$d to ana $ ho di $r$nt #inds o air&ra t ar$ sho n in th$ d$si/n o th$ data 'od$ .

    $ !s$ th$ &on&$%t o KInh$ritan&$H to a&hi$)$ this. Inh$ritan&$ in data 'od$ in/ is !st th$sa'$ as th$ /$n$ra '$anin/ o th$ ord. It '$ans that at a hi/h $)$ , $ id$nti th$/$n$ra na'$ o th$ KThin/ o Int$r$stH and th$ &hara&t$risti&s that a o th$s$ thin/s shar$.

    For $ a'% $, an air&ra t i ha)$ a na'$ or th$ t %$ o air&ra t, s!&h as Tornado and it i"$ o a &$rtain t %$, s!&h as i $d- in/ or rotar .

    +t th$ o $r $)$ o i $d- in/ air&ra t, an air&ra t i ha)$ a 'ini'!' $n/th or th$r!n a that th$ air&ra t n$$ds in ord$r to ta#$ o .

    This sit!ation is sho n in th$ o o in/ dia/ra':

  • 8/12/2019 Learn Data Modelling PDF

    76/112

  • 8/12/2019 Learn Data Modelling PDF

    77/112

  • 8/12/2019 Learn Data Modelling PDF

    78/112

    Williams | Learn Data Modeling by Example - Part 1 /*

    %.11.2 Customer &ddresses

    This is a /$n$ra and $ i" $ a%%roa&h to hand in/ addr$ss$s in o!r data 'od$ .

    $ ha)$ a s$%arat$ +ddr$ss Ta" $, hi&h a o s !s to ha)$ 'or$ than on$ addr$ss or an&!sto'$r )$r $asi .

    This d$si/n a so has oth$r "$n$ its: $ &an a&&o''odat$ 'or$ than on$ %$rson at th$ sa'$ addr$ss. $ n$$d to

    do this "$&a!s$ di $r$nt '$'"$rs o a a'i 'a si/n !% s$%arat$ ith+'a on.

    ith a s$%arat$ ta" $ o addr$ss$s, $ &an $asi !s$ &o''$r&ia so t ar$ to)a idat$ o!r addr$ss$s.

    To ind this #ind o so t ar$, si'% oo/ $ H+ddr$ss Ma idation So t ar$H. $ ha)$ !s$d D+S ith /r$at s!&&$ss in th$ %ast. ith this a%%roa&h, $ &an a a s "$ s!r$ that $ ha)$ 100 /ood addr$ss

    data in o!r data"as$.

    %.11." eference Data

    ?$ $r$n&$ data has th$ o o in/ &hara&t$risti&s:

    It do$s not &han/$ )$r '!&h. It has a r$ ati)$ s'a n!'"$r o )a !$s, !s!a $ss than a $ do $n and

    n$)$r 'or$ than a $ h!ndr$d. Th$r$ or$ $ &an sho it ith a &od$ as a %ri'ar #$ . *ata in ?$ $r$n&$ *ata Ta" $s &an "$ !s$d to %o%! at$ dro%-do n ists or

    !s$rs. In this a , it is !s$d to $ns!r$ that a n$ data is )a id.

  • 8/12/2019 Learn Data Modelling PDF

    79/112

    Williams | Learn Data Modeling by Example - Part 1 /$

    %.11.% )tandards In th$ +ddr$ss Ta" $, o! i s$$ a i$ d &a $d

  • 8/12/2019 Learn Data Modelling PDF

    80/112

    Williams | Learn Data Modeling by Example - Part 1 *&

    %.11.( &ircraft eBam!le

    This dia/ra' sho s t o "asi& $ a'% $s o ?$ $r$n&$ data that 'i/ht a%% to o!r si'% $air&ra t data 'od$ .

    %.12 What ha'e ;e learned?

    In this &ha%t$r, $ ha)$ &o)$r$d th$ "asi& &on&$%ts in data 'od$ in/, in& !din/: Pri'ar and For$i/n >$ s

    ;n$-to- an and an -to- an ?$ ationshi%s

    ?a""it Ears or ?$ $ i)$ ?$ ationshi%s

    Inh$ritan&$

  • 8/12/2019 Learn Data Modelling PDF

    81/112

    Williams | Learn Data Modeling by Example - Part 1 *1

    ?$ $r$n&$ *ata

    That i /i)$ !s th$ "asi&s o th$ an/!a/$ in hi&h $ &an ta # a"o!t and d$s&ri"$ data'od$ s.

  • 8/12/2019 Learn Data Modelling PDF

    82/112

    Williams | Learn Data Modeling by Example - Part 1 *2

    (. & Database for a 8ideo >ame

    (.1 &!!roach

    Th$ irst st$% is to d$&id$ on th$ th$'$ o th$ a'$.

    For this T!toria , $ ha)$ &hos$n a KShoot K$' %H hi&h is "as$d on a )$r %o%! ar a'$or th$ i&roso t U"o &a $d $ars o ar.

    =$r$ is th$ %a/$ on th$ *ata"as$ +ns $rs $" Sit$ that sho s th$ *ata od$ :-

    htt%: .data"as$ans $rs.or/ data5'od$ s /a'in/5/$ars5o 5 ar ind$ .ht'

    This >i-Start *ata od$ $at!r$s :-

    th$ ood ! s, ho ar$ So di$rs

    th$ $a%ons

    th$ Bad ! s, ho ar$ Lo&!sts

    th$ ?! $s o En/a/$'$nt "$t $$n th$ ood ! s and th$ Bad ! s

    (.2 The >ood >u s

    Th$r$ ar$ s$)$n So di$rs in th$ a'$, ith di $r$nt ?an#s and di $r$nt "a/ro!nds

    (.2.1 Colonel 8ictor 6offman

    http://www.databaseanswers.org/data_models/gaming_gears_of_war/index.htmhttp://www.databaseanswers.org/data_models/gaming_gears_of_war/index.htm
  • 8/12/2019 Learn Data Modelling PDF

    83/112

  • 8/12/2019 Learn Data Modelling PDF

    84/112

    Williams | Learn Data Modeling by Example - Part 1 *'

    =is Pro i $ r$ads :-

    F$ ha)$ /i)$n 'or$ and ost as '!&h as ar&!s F$ni .

    + %ro'isin/ so di$r d!rin/ th$ P$nd! !' ars, ar&!s sa $)$r thin/ &han/$ onE'$r/$n&$ *a .

    ar&!s "ra)$ o!/ht th$ Lo&!st or t$n $ars, th$n, d!rin/ an int$ns$ "att $, h$

    a"andon$d his %ost to r$s&!$ his ath$r, Pro $ssor +da' F$ni .

    B!t h$ arri)$d too at$.

    ar&!s as tri$d or d$r$ i&tion o d!t and s$nt$n&$d to 40 $ars inVa&into a i'!' S$&!rit Prison.

    In&ar&$rat$d or o!r $ars "$ or$ "$in/ r$ $as$d to i/ht Lo&!st a/ain, ar&!s as at$r%ro'ot$d to s$r/$ant.

  • 8/12/2019 Learn Data Modelling PDF

    85/112

    Williams | Learn Data Modeling by Example - Part 1 *)

    (.2." Pri'ate Damian :aird

    =is Pro i $ r$ads :-

    Pri)at$ *a'on Baird is a d$di&at$d t$&h-h$ad and %ro $ssiona s#$%ti&.In Baird

  • 8/12/2019 Learn Data Modelling PDF

    86/112

    Williams | Learn Data Modeling by Example - Part 1 *.

    (.2.% Pri'ate &nthon Carmine

    =is Pro i $ r$ads :-

    +s th$ o!n/$st '$'"$r o *$ ta S(!ad d!rin/ th$ Li/ht'ass ; $nsi)$, hat Pri)at$

    +nthon ar'in$ a$d in &o'"at $ %$ri$n&$, h$ 'ad$ !% or in !n"rid $d $nth!sias'.

  • 8/12/2019 Learn Data Modelling PDF

    87/112

    Williams | Learn Data Modeling by Example - Part 1 */

    (.2.( Pri'ate Dominic )antiago

    =is Pro i $ r$ads :-

    + s$ason$d i/ht$r hoHs %ositi)$ $)$n in th$ dar#$st o ho!rs, *o'ini& Santia/o r$$d his

    "$st ri$nd ar&!s F$ni ro' Va&into a i'!' S$&!rit Prison and r$&r!it$d hi' into *$ taS(!ad.

    =is "att $ i$ d int$nsit is ri)a $d on " his o a t to ar&!s--and his i $, aria.

    *o'ini&

  • 8/12/2019 Learn Data Modelling PDF

    88/112

    Williams | Learn Data Modeling by Example - Part 1 **

    (.2.* #ieutenant &n a )troud

    =$r Pro i $ r$ads :-

    +s *$ taHs ontro &onta&t, +n a Stro!d /!id$d *$ ta S(!ad on th$ir 'ission to d$stro th$

    Lo&!st, %ro)idin/ )ita int$ and strat$/i& ad)i&$ to th$ s(!ad in th$ i$ d.

  • 8/12/2019 Learn Data Modelling PDF

    89/112

    Williams | Learn Data Modeling by Example - Part 1 *$

    (.2. )amantha @)am$ : rne

    =$r Pro i $ r$ads :-

    Sa'antha Sa' B rn$

  • 8/12/2019 Learn Data Modelling PDF

    90/112

    Williams | Learn Data Modeling by Example - Part 1 $&

    (." Choosing the Wea!ons

    No $ &an &hoos$ th$ $a%ons to 'at&h th$ So di$rHs !ni(!$ (!a iti$s.

    Th$s$ ar$ o!r o%tions that ar$ d$s&ri"$d h$r$.

    (.".1 :oomshot >renade #ocust

    Descri!tion of the :oomshot >renade #ocust is 9-

  • 8/12/2019 Learn Data Modelling PDF

    91/112

    Williams | Learn Data Modeling by Example - Part 1 $1

    + Boo'shot r$nad$ Lo&!st is a short- to 'id-ran/$ /r$nad$ a!n&h$r that &an $asi ta#$do n a tar/$t in a sin/ $ shot

  • 8/12/2019 Learn Data Modelling PDF

    92/112

    Williams | Learn Data Modeling by Example - Part 1 $2

    (.".2 6ammer of Da;n

    Descri!tion of the 6ammer of Da;n is 9-

    Th$ =a''$r o *a n is +n I'! sion-%o $r$d sat$ it$ that rains do n a d$)astatin/%arti& $ $n$r/ str$a'.It &an i%$ o!t an thin/ ro' s'a Lo&!st s(!ads to $ntir$ &it " os.

  • 8/12/2019 Learn Data Modelling PDF

    93/112

    Williams | Learn Data Modeling by Example - Part 1 $"

    (."." #ong )hot )ni!er ifle

    Descri!tion of the #ongshot is 9-

    Th$ Lon/shot Sni%$r ?i $ is a hi/h-%o $r$d, "o t-a&tion sni%$r ri $ ith a %o $r ! oo'

    si/ht.

  • 8/12/2019 Learn Data Modelling PDF

    94/112

    Williams | Learn Data Modeling by Example - Part 1 $'

    (.".% =ne )hot

    Descri!tion of the =ne)hot is 9-

    Th$ ;n$Shot is an inti'idatin/ and o"s&$n$ %o $r ! on/-ran/$ sni%$r ri $ &a%a" $ od$stro in/ 'ost o$s in a sin/ $ shot

  • 8/12/2019 Learn Data Modelling PDF

    95/112

    Williams | Learn Data Modeling by Example - Part 1 $)

    (.".( )corcher /lamethro;er

    Descri!tion of the /lamethro;er is 9-

    Th$ S&or&h$r F a'$thro $r is a short- to 'id-ran/$ $a%on that $'its a &on&$ntrat$dstr$a' o ir$ that &hars o!r $n$'i$s.

  • 8/12/2019 Learn Data Modelling PDF

    96/112

    Williams | Learn Data Modeling by Example - Part 1 $.

    (.".* Troi0a

    Descri!tion of the Turret is 9-

    Th$ Troi#a T!rr$t is a hi/h-%o $r$d, t!rr$t-'o!nt$d Lo&!st 'a&hin$ /!n that ir$s

    &ontin!o!s ro!nds a&ross th$ "att $ i$ d.

  • 8/12/2019 Learn Data Modelling PDF

    97/112

    Williams | Learn Data Modeling by Example - Part 1 $/

    (.". )ummar

    Th$ d$s&ri%tions o a th$ $a%ons oo#s i#$ this :-

    1J + Boo'shot r$nad$ Lo&!st is a short- to 'id-ran/$ grenade launcher that &an$asi ta#$ do n a tar/$t in a sin/ $ shot.

    2J Th$ =a''$r o *a n is +n I'! sion-%o $r$d satellite that rains do n ad$)astatin/ %arti& $ $n$r/ str$a'. It &an i%$ o!t an thin/ ro' s'a Lo&!sts(!ads to $ntir$ &it " os.

    3J Th$ Lon/shot Sni%$r ?i $ is a hi/h-%o $r$d, "o t-a&tion sni%$r rifle ith a %o $r !oo' si/ht.

    4J Th$ ;n$Shot is an inti'idatin/ and o"s&$n$ %o $r ! on/-ran/$ sni%$r rifle&a%a" $ o d$stro in/ 'ost o$s in a sin/ $ shot

    J Th$ S&or&h$r /lamethro;er is a short- to 'id-ran/$ $a%on that $'its a&on&$ntrat$d str$a' o ir$ that &hars o!r $n$'i$s.

    6J Th$ Troi#a T!rr$t is a hi/h-%o $r$d, t!rr$t-'o!nt$d Lo&!st machine gun that ir$s&ontin!o!s ro!nds a&ross th$ "att $ i$ d.

    +n ana sis o th$s$ $a%on id$nti i$s that $ ha)$ on$ F a'$thro $r, thr$$ !ns and aSat$ it$.

  • 8/12/2019 Learn Data Modelling PDF

    98/112

    Williams | Learn Data Modeling by Example - Part 1 $*

    Th$r$ or$, th$ ra/'$nt o o!r *ata od$ or $a%ons oo#s i#$ this :-

  • 8/12/2019 Learn Data Modelling PDF

    99/112

    Williams | Learn Data Modeling by Example - Part 1 $$

    (.% The :ad >u s

    In this /a'$, th$ Bad ! s ar$ a Lo&!sts. =o $)$r, th$ &o'$ in di $r$nt sha%$s andsi $s, and o $r di $r$nt thr$ats.

    (.(.1 :erser0ers

    The :erser0ers Profile reads 9-

    B$rs$r#$rs ar$ $'a $ Lo&!sts.Th$ !s$ th$ir #$$n h$arin/ and s$ns$ o s'$ to s$$# o!t th$ir %r$ and " !d/$on it tod$ath ith th$ir ha''$r- i#$ ists.

  • 8/12/2019 Learn Data Modelling PDF

    100/112

    Williams | Learn Data Modeling by Example - Part 1 1&&

    (.(.2 :ruma0s

    The :ruma0s Profile reads 9-

    To stand in th$ Br!'a#Hs shado is to star$ d$ath in th$ a&$.

    Th$s$ h! #in/ ar 'a&hin$s %oss$ss a d$ad assort'$nt o $a%ons, ro' rist-'o!nt$d'a&hin$ /!ns to o)$r-th$-sho! d$r ro$t a!n&h$rs.For an &han&$ o s!r)i)a a/ainst a Br!'a#, " ast a a "its o its ar'or to r$)$a th$ so t,

    $a# s%ots !nd$rn$ath.

  • 8/12/2019 Learn Data Modelling PDF

    101/112

  • 8/12/2019 Learn Data Modelling PDF

    102/112

    Williams | Learn Data Modeling by Example - Part 1 1&2

    (.(.% &&M

    The &&M Profile reads 9-

    +n i'%osin/ i/!r$, ?++ to $rs o)$r a h!'ans, his si $nt d$'$anor &on&$a in/ a )io $ntand '$r&i $ss nat!r$.In "att $, ?++ is a or'ida" $ o%%on$nt ho i$ ds a Troi#a a&hin$ !n hi $ &ontro in/th$ >r that h$ so'$ti'$s $'% o s as a shi$ d. ?++ '$t his d$'is$ at th$ hands o

    ar&!s F$ni a"oard th$ T ro Pi ar, h$r$ his r$i/n o t$rror &a'$ to an a"r!%t and$ &o'$ $nd.

  • 8/12/2019 Learn Data Modelling PDF

    103/112

    Williams | Learn Data Modeling by Example - Part 1 1&"

    (.(.( )ummar

    ;n$ o th$ Lo&!sts is id$nti i$d as "$in/ $'a $. Th$r$ or$, $ ha)$ to ass!'$ that aLo&!sts ha)$ a /$nd$r, hi&h i "$ a $, F$'a $ or n#no n.

    Lo&!sts ha)$ a d$s&ri%tion o th$ir str$n/ths and $a#n$ss$s.

    Th$ %hotos o th$ Lo&!sts sho th$' ha)in/ ar's and $/s. Th$r$ or$ $ in& !d$ an +r'o!nt and L$/ o!nt i$ ds, hi&h $ d$ a! t to t o o $a&h.

    $nd$r is a &od$ that has on thr$$ )a !$s O a $, F$'a $ and or n#no n.

    So $ &an in& !d$ th$' in a i$ d &a $d K $nd$r5 F H.

    Th$r$ or$, o!r Lo&!sts Ta" $ oo#s i#$ this :-

  • 8/12/2019 Learn Data Modelling PDF

    104/112

    Williams | Learn Data Modeling by Example - Part 1 1&'

    (.( Thin0ing in >eneral Terms

    (.(.1 )oldiers5 #ocusts and Inheritance

    In !nd$rstandin/ th$ a'$, $ n$$d to &onsid$r ho to si'% i th$ a $ d$ in$ So di$rsand Lo&!sts.

    This i h$ % !s to d$ in$ th$ a'$ at a hi/h$r $)$ and thin# a"o!t it in a 'or$ /$n$raa .

    ;!r irst st$% is to &onsid$r So di$rs and Lo&!sts as Parti&i%ants in th$ a'$.

    $ &o! d &a th$' B$in/s or +&tors or ?o $s "!t or si'% i&it at this "asi& $)$ $ &ath$' si'% KParti&i%antsH.

    Th$ "oth ha)$ Na'$s, and a $nd$r. Th$r$ or$, $ 'o)$ th$ $nd$r5 F to th$

    Parti&i%ants $ntit .

    So di$rs ha)$ a i itar Ba/ro!nd and Lo&!sts ha)$ a Str$nths5and5 $a#n$ss$s i$ d.

    $ &an r$% a&$ th$s$ t o " on$ i$ d in th$ hi/h$r KParti&i%antsH Ta" $.

    $ i &a this i$ d KPro i $H.

    Th$r$ or$, $ sho o!r n$ KParti&i%antsH ta" $ as th$ Par$nt or KS!%$r-T %$. ith So di$rsand Lo&!sts as hi dr$n or S!"-T %$s.

  • 8/12/2019 Learn Data Modelling PDF

    105/112

    Williams | Learn Data Modeling by Example - Part 1 1&)

    Th$ *ata od$ ra/'$nt i oo# i#$ this :-

  • 8/12/2019 Learn Data Modelling PDF

    106/112

    Williams | Learn Data Modeling by Example - Part 1 1&.

    (.(.2 /a'ourite Wea!ons and Man -to-Man elationshi!s

    It t!rns o!t that "oth So di$rs and Lo&!sts ha)$ a)o!rit$ $a%ons and no that $ ha)$$sta" ish$d a Parti&i%ants $ntit , $ &an a)o!rit$ $a%ons as an attri"!t$ o th$Parti&i%ants $ntit .

    Ea&h Parti&i%ant &an ha)$ 'an a)o!rit$ $a%ons, and $a&h %arti&! ar t %$ o $a%on &an"$ th$ a)o!rit$ o 'an Parti&i%ant.

    In *ata od$ in/ t$r's, $ &a this as a K an -to- an ?$ ationshi%H "$t $$n Parti&i%antsand $a%ons.

    $ ha)$ 'o)$d th$ Fa)o!rit$5 $a%ons attri"!t$ ro' th$ Lo&!st $ntit to th$ n$Fa)o!rit$5 $a%ons $ntit .

    Th$r$ or$, th$ *ata od$ ra/'$nt So di$rs and Lo&!sts oo# i#$ this, h$r$ th$ KFa)o!rit$5 $a%onsH $ntit sho s that $a&h Parti&i%ant &an ha)$ 'an a)o!rit$ $a%ons

    and )i&$ )$rsa. :-

  • 8/12/2019 Learn Data Modelling PDF

    107/112

    Williams | Learn Data Modeling by Example - Part 1 1&/

    (.* ules of Engagement

    In /$n$ra t$r's , th$ So di$rs i ha)$ a n!'"$r o ;" $&ti)$s and i ha)$ to $n/a/$ith th$ Lo&!sts to a&hi$)$ th$s$ ;" $&ti)$s.

    $ i &onsid$r th$s$ $n/a/$'$nt as a s$ri$s o E)$nts in)o )in/ a Parti&i%ants "it not$)$r ti'$J.

    Ea&h E)$nt i ha)$ an o!t&o'$ i#$ Mi&tor or *$ $atJ and !s$ ?$so!r&$s, s!&h asB! $ts, that 'i/ht "$ in i'it$d s!%% .

  • 8/12/2019 Learn Data Modelling PDF

    108/112

    Williams | Learn Data Modeling by Example - Part 1 1&*

    (. Design Patterns

    (. .1 Introduction

    *$si/n Patt$rns ar$ )$r %o $r ! "$&a!s$ th$ h$ % !s to r$&o/nis$ si'i ar sit!ations thato&&!r )$r r$(!$nt in r$a i $.

    Th$n $ start thin#in/ i#$ a *ata"as$ *$si/n$r or *ata od$ $r and s!dd$n , it "$&o'$sa ot $asi$r.

    T0e ob io%s !andidate for a Design Patter in o%r simplified ,ideo ame is E ents

    (. .2 Com!lete Design Pattern

    T0is Model s0o s all t0e !omponents in t0e Complete Design Pattern 3-

    T0e logi! be0ind different ariations says t0at 3-

    T0ere ill al ays be an E ent

    T0ere ill al ays be at least one Parti!ipant

    Weapons ill be in ol ed for an E ent t0at is a fig0t bet een (oldiers and Lo!%sts

  • 8/12/2019 Learn Data Modelling PDF

    109/112

    Williams | Learn Data Modeling by Example - Part 1 1&$

    (. ." Partici!ants and E'ents

    T0is is t0e smallest ersion of t0e Pattern4 be!a%se an E ent ill al ays be in ol ed and Parti!ipantsill al ays be in ol ed

    5f e t0in# abo%t an E ent t0at does not %se Weapons4 for example4 retreating or ad an!ing it0o%tengaging it0 t0e Lo!%sts4 t0en e 0a e a simpler Data Model t0at does not in ol e Weapons and loo#sli#e t0is 3-

    (. .% With Wea!ons5f t0e (oldiers meet Lo!%sts 0ile t0ey are on t0e mo e4 t0en e add Weapons and t0e Data Model t0atloo#s li#e t0is 3-

  • 8/12/2019 Learn Data Modelling PDF

    110/112

    Williams | Learn Data Modeling by Example - Part 1 11&

    (. .( With Wea!ons and esources

    5f t0e (oldiers meet Lo!%sts 0ile t0ey are on t0e mo e4 t0en e add Weapons and t0e Data Model t0atloo#s li#e t0is4 0i!0 is t0e f%ll Design Pattern t0at e started it0 3-

  • 8/12/2019 Learn Data Modelling PDF

    111/112

    Williams | Learn Data Modeling by Example - Part 1 111

  • 8/12/2019 Learn Data Modelling PDF

    112/112

    Williams | Learn Data Modeling by Example - Part 1 112

    (. The Com!lete Data Model

    h$n $ &o'"in$ th$ So di$rs, Lo&!sts and $a%ons, this is hat o!r o'% $t$ *ata od$oo#s i#$.

    $ ha)$ $ t o!t th$ ?$ $r$n&$ *ata ta" $s to #$$% th$ od$ si'% $ and $asi$r to r$ad.

    For th$ sa'$ r$ason, $ ha)$ in& !d$d on th$ Pri'ar and For$i/n >$ s and a so o'itt$dth$ +ttri"!t$s.