Solutions Manual for Database Systems Design Implementation and Management 12th Edition by Coronel

Page 1

C hapter 2 Data Mod els

Solutions Manual for Database Systems Design Implementation and Management 12th Edition by Coronel Full clear download (no error formatting) at : https://downloadlink.org/p/solutions-manual-for-database-systems-designimplementation-and-management-12th-edition-by-coronel/ Test Bank for Database Systems Design Implementation and Management 12th Edition by Coronel Full clear download (no error formatting) at : https://downloadlink.org/p/test-bank-for-database-systems-design-implementationand-management-12th-edition-by-coronel/

Chapt er 2 Data Mod els Di s cus sio n Fo cus Although all o f the topi c s cover ed in thi s ch apter are im portant, our stude nts have given us consi s tent feedback:Ifyoucanwriteprecisebusiness rules from a descript ion of operati ons, databas e designis notthatdifficult.Therefore,once data modelin g (S ecti ons 2 -1, "Data Model ing and DataModels", Section2-2"TheImportanceofD ata Models,” a nd 2 -3, “Data Model Bas ic Buil ding Blocks,”)hasbeen examinedindetail,Section2 -4, “ Business R ule s,” shoul d r eceive a lot of cl asstimeandattention. Perhapsitisusefulto argue that the answ ers to questi ons 2 and 3 in the ReviewQuestionssectionare thekeyto successful de sign. That’s wh y w e hav e found it particularl y im portant to focus on business rules and thei r im pact on the database d esi gn proc ess . Wh at are b u sin ess rul es, w h at is th eir source, an d w h y are they cru cial ? Business rules are p re cise l y w ritten and unamb iguous statements that are d erived f rom a d etailed descriptionofanorganization'sope rati on s. Wh en w rit ten properly , busi ness rules defineoneormoreof thefollowingmodelingc omponents: enti ti es relations hips att ributes connecti vit ies 14


C hapter 2 Data Mod cardinali ti es – these will be ex ami elsned in detail in C hapter 3, “Th e R elatio nal Datab ase Model.” Basically,thecardinalitiesyield the mi nim um and max im um number of enti t y o ccu rrencesinan entity.Forexample,the relations hip decribed b y “ a professo r teach esoneormoreclasses” meansthatthePROFESS OR enti t y is re fer enced at least onc e and no mor e than fou r t im es in the C LASS enti t y. const raint s Bec ause the busi ness rules form the basis of the d ata modeling p rocess, the ir precise stat ement is crucial tothesuccessofthedatabasedesign. And, be cause the busi ness rul es are de rived from a precise descriptionofoperations,muchofthe desi gn 's s uccess d epends on the a ccura c y o f the desc riptio n of operati ons. Ex ampl es of business rules are: An invoice contains one or more invoi ce li nes. Each invoi ce li ne is asso ciated with a sin gle invoice. A store empl o ys man y e mpl o yees. Each empl o ye e is empl oye d b y onl y on e store. A coll e ge has man y d epa rtments. Each d epartment b elon gs to a sin gle coll e ge. (T his busi ness rule refle cts a unive rsit y th athas multiplecollegessuchasBusiness, Liber al Arts, Educati on, En gineeri n g, etc.)

15


C hapter 2 Data Mod els A driver ma y b e assi gned to drive man y di ffe rent vehicles. Each vehi cle c an be driv en b y m an y drive rs. (Not e: Keep in mi nd that thi s busi ness rule re flects the assi gnment of d rivers during som e p eriod of ti me.) A cli ent m a y sign man y contracts. Each contr act i s si gn ed b y onl y one cli ent. A sales rep resentative m a y writ e man y cont racts. Each contr act i s writ ten b y one s ales re pres entative. Note that ea ch r elations hip definiti on requires t he definiti on of two bus iness rules. Fo r ex ampl e ,the relationshipbetweentheINVOICEand (invoice ) LIN E enti ti es is defined b y the first twobusinessrules inthebulletedlist.Thistwo -wa y requir ement e x ists because there is al wa ys a two-wayrelationship betweenanytworelated enti ti es. (This t wo -w a y r elations hip descriptionalsoreflectstheimplementation b y man y o f the avail abl e database d esign tool s.) Keep in mi nd that the ER diagrams cann ot alwa ys refle ct all of the busi ness rules. For ex ampl e, ex ami ne the foll owing busi ness ru le: A custom er cannot be gi ven a credit li ne over $10,000 unless that customer has maintained a sati sfactor y c redit hist or y (as determi ned b y th e cr edit mana ger ) durin g the past t wo ye ars. This busi ness rule desc r ibes a const raint that ca nnot be shown in the E R diagram. Th e busi ne s s rule refle cted in thi s const rai nt would be h andled at the appli cati ons softw ar e level throu gh the use ofa triggerorastoredprocedure.(Your students will learn about tri gge rs and stored proc edures in C h apter 8, “Advanc ed S Q L.�) Given their im portan ce to successful design, w e cannot overstate the im portance of busi ness rulesand theirderivationfromproperlywrit ten d escriptio n of oper ati ons. It is no t t oo earl y tostartaskingstudents towritebusinessrules for sim ple descriptio ns of operati ons. Be gin b y usingfamiliaroperational scenarios,suchas bu yin g a book at the book store, re gist erin g for a clas s, pa yin g a parkin g ti cke t, or renti ng a DVD. Also, tr y rev ersin g the pr ocess: Give the students a chanc e to writ e the bus iness rules from abasicdata modelsuchastheonerepresentedby the tex t’s Figu re 2.1 and 2.2. A sk your students to writethe businessrulesthatarethefoundation of th e r e lational dia gram in Fi gure 2. 2 and th en pointtheir attentiontotherelationaltables in Fi gure 2. 1 t o indi cate that an AGENT occurr enc e canoccurmultiple timesintheCUSTOMERentity, thus il lust rati n g the impl ementati on im pact of the busi ness rules An a gent c an serv e man y custom ers. Each custom er is se rved b y one a gent.

16


C hapter 2 Data Mod els

Answ ers to Revi ew Ques tio ns 1. Discus s the imp ortan ce of d ata mod eli n g. A data model is a r elativel y sim ple rep resent ati on, usuall y graphi cal, of a more compl ex re alworld objectevent.Thedatamodel’smain functi on is to help us understand the compl ex it iesofthereal- worldenvironment.The database d esign er us es data models to fa cil it atetheinteractionamong designers,applic ati on programm ers, and end users. In sho rt, a gooddatamodelisa communicationsdevice that helps eli mi nate (or at least subst anti all yreduce)discrepanciesbetween thedatabase desi gn’s co mponents and the r eal w orld data environment.Thedevelopmentofdata models, bolst ered b y po werful datab ase desi gn t ools, has made it possi ble to subst anti all y dim ini sh the database d esi gn er ror potential. (R eview S ecti o n 2.1 in detail .) 2. Wh at is a b u sin ess rul e , an d w h at is its pu rp ose in d ata mod eli n g? A busi ness rule is a brief , precise, and unambi gou s descriptio n of a poli c y, procedur e, or principle withinaspecificorganization’s environment. In a sense, busi ness rules are mi snamed:theyapplyto anyorganization--abus iness, a gov ernment unit , a reli gious group, or aresearchlaboratory;large orsmall--that st ores and uses data to gene rate inf ormati on. Business rules are deriv e d from a descript ion of operati ons . As it s name im pli es, a descriptionof operationsisadetailed narrati ve that desc ribes the operati onal environmentofanorganization. Sucha descriptio n requir es gr eat pre cisi on and detail. If the des criptio n of operati ons is incorrector inomplete,thebusinessrulesde rived f rom it will not reflect the r eal world dataenvironment accurately,thusleadingto poor l y de fined d ata mo dels, whi ch l ead to poor databasedesigns.Inturn, poordatabased esigns le ad to poor appli cati ons, thus sett ing thestageforpoordecisionmaking– whichmay ult im atel y le a d to t he demi se of the or ganiz ati on . Note espe ciall y that b us iness rules help to cr eat e and enfor ce acti ons w it hin that organiz ation’s environment.Businessrulesmustber ende red in writ ing and upd ated to refle ct an y changeinthe organization’soperational environment. P roperl y writ ten busi n ess rules a re used to d efine enti ti es, att ributes, r elati onshi ps, andconstraints. Becausethesecomponents form the basis for a databas e desi gn, the car efulderivationand definitionofbusiness rules is crucial to good data base desi gn. 3. How d o you tran slate b u sin ess rul es in to data mod el co mp on en ts ? As a gen eral rule, a nou n in a busi ness rule will translate int o an enti t y i n the model, and a ve rb (acti ve o r passi v e ) asso ciating nouns will trans late int o a relations hip among the enti ti es.For example,thebusinessrule“acustomer ma y gene r ate man y invoi ces ” conta ins two nouns (customer andinvoice)andaverb(“generate” ) that associat e s them. 17


C hapter 2 Data Mod els

4. Describ e the b a sic f eatures of the r elation al d ata mod el an d d iscus s their imp or tance to th e en d u ser an d the design er. A relational d atabas e is a singl e data reposi tor y t hat provides both stru ctural and d ata independence whilemaintainingconceptual si mpl icit y. The relational d atabase model is perceived b y th e user to be a coll ecti on of tables in which dataare stored.Eachtableresemblesamatrix compos ed of row and colum ns. Tabl es are relat ed toeachother bysharingacommonvalueinoneof their colum ns. The relati onal model rep resents a b reakthrou gh f or users and d esi gners b ecause it lets them operate inasimplerconceptualenvironment. End users fi nd it easier to visuali z e their data asacollectionof dataorganizedasamatrix. Designers find it ea sier to de a l with con cep tualdatarepresentation, freeingthemfrom the co mpl ex ities associated wit h ph ysical d ata r epres entation. 5. E xp lai n h ow the en tity relation sh ip (ER) mod el helpedproduceamorestructuredrelational d atabase design en viron men t. An enti t y rela ti onshi p model, also known as an E R M, helps identif y the d atabase 's main enti ti esand theirrelationships.BecausetheERM compon en ts are graphic all y repr es ented, theirroleismore easilyunderstood.Using the ER dia gr am, it ’s eas y to map the ERM to the r elationaldatabase model’stablesandattrib utes. This m apping pro ce ss uses a series o f well -definedstepstogenerateall therequired databas e structures. (This structure s mapping approa ch is augm ented b y a pro ces s known as normali z ati on, which is covere d in detail in C hapter 6 “Normali z ati on of Database Tables.”) 6. Cons id er the scen ario d escrib ed b y the state me nt“Acustomercanmakemanypayments,but each p ay men t is mad e b y on ly on e cu sto me r” as the b asisforanentityrelationshipdiagram (ERD) rep resen tation . This scenario yi elds the ERDs shown in Fi gur e Q2. 6. (Note th e use o f th e P owerPoi nt C row’s Fo ot template.WewillstartusingtheVisioP rofessi onal -gene rated C row’s Foo t ERDs in C hapter3,but youcan,ofcourse,continuetous e the templ ate if you do not hav e ac cess t o Visi o P rofessi onal.)

Fi g ure Q2.6 The Chen and Crow ’s Foo t ERDs for Ques ti on 6

18


C hapter 2 Data Mod els Chen mo de l 1M CU S TO M ER

ma ke s

P AYM EN T

Cr o w’ s F o ot m ode l

CU S TO M ER

ma ke s

P AYM EN T

NOTE Re min d you r stud en ts again that w e h ave n ot (yet ) il lu strated t h e ef f ect of op tion al relation sh ip s on the E RD’s p re s en tation . Op tion al relation sh ip s and their t reat men t a re cover ed in d etail in Chap ter 4, “E n tity Relation sh ip (ER) Mod eli n g.”

7. Wh y is a n ob ject said to have greate r se man tic con ten t th an an en tity? An object has great er s e mantic content b ec ause it embo dies both dat a a nd behavior. That is, the object contains, in addit ion to data, also the descriptio n of the operati ons that ma y be per formed b y the object. 8. Wh at is the d if f eren ce b etw een an ob ject an d a class in the ob ject oriented d ata mod e l (OODM)? An object is an inst anc e of a spe cific cl ass. It is useful to point out that the object is a run -ti me concept,whiletheclassisamorestaticdes criptio n. Objects that shar e sim il ar ch ara cterist ics ar e gro uped in classes. A class is a coll ecti on of similar objectswithsharedstructure(att ributes) and be havior (methods .) There fore, a classresemblesan entityset.However,acla ss also i ncludes a set of p rocedur es known as meth ods.

18


C hapter 2 Data Mod els 9. How w ou ld you mod el Q u estion 6 with an OODM? (Use Figu r e 2. 4 as you r gu i d e.) The OODM that co rresp onds t o questi on 6’s ERD is shown in Figu re Q1. 9:

Fi g ure Q2.9 The OODM Mo del fo r Ques ti o n 9 CU S TO M ER M P AYM EN T

10. Wh at is an E RDM, an d what role d oes it p lay in the mod ern (prod u ction ) d atabase en vironmen t? The Ex tended R elational Data Model (ER DM) is the relational data model’s response to the Object OrientedDataModel(OODM.)Mostcurr ent R DBMS es support at le ast a few of the ERDM ’s ex tensions. For ex ampl e, support for lar ge binar y objects (B LO Bs ) is now comm on. Al though the "ERDM " label has fr equentl y be e n used in the databas e li terature to des cribe th e relational datab ase mode l's respons e to the OOD M's ch all en ges, C . J . Date objects to the ERDM label for the foll owin g r e asons: 1 The useful contribut ion of "th e obj e ct model" is it s abil it y to let use rs de fine their o wn -- and often ver y compl e x -- data t ypes. Ho we ver, mathematic al struc tures knownas "domains"intherelational model also provide thi s abil it y. The refo re,arelationalDBMS thatproperlysuppo rts such domains gr eatl y di mi nishes the reasonforusingtheobject model.Given proper sup port for domains, relational database models ar e quit e capable of handli ng th e compl ex data encounte red in ti me series, en ginee ring d esign, of fice autom ati on, financial mode li ng, and so on. Be cause the relational model can support complexdatatypes,thenotionof an "ex tended relational databas e mod el" orERDMis "extremelyinappropriateand inac curat e" and "it s hould be firml y resis ted."(Thecapability thatissupposedly b ein g ex tended is alread y ther e !) Even the label ob ject/r elation al mod el (O/ RDM) is not quit e accura te, because the relational database mode l's domain is not an object model structure. However, ther e are alreadyquiteafewO/Rproducts-- also known a s Un iversal Datab ase Serve rs --onthe market.Therefore,Dateconced es that we are pr obabl y stuck with the O/R label.Infact, Datebelievesthat"anO/R s ystem i s in ever yon e 's future. " Mor e pr ecisely,Datearguesthat atrueO/Rsystem would be "nothi ng mor e no r les s than a tru e r elational s ystem -- which is to sa y, a s yst em t hat supp orts the relational model, with all t hat such support entail s." 19


1

C . J . Date, "Ba ck To the R elational Future ", htt p:/ /www.dbpd.com/ vault /9808date.htm l

20


C hapter 2 Data Mod els C . J . Date concludes his discussi on b y obs ervin g that "W e need do nothi ng to the rel ati onal model achieveobjectfunctionality.(Nothin g, th at is, ex cept im plement it , somethi ng that doesn'tyetseem tohavebeentriedinthecomm ercial wo rld.)" 11. Wh at is a relation sh ip , an d w h at th ree types of relation sh ip s exist? A relations hip i s an assoc iation among (two o r mo r e) enti ti es. Thr ee t ypes o f relations hips exist:one- to-one(1:1),one-to-many(1:M), and man y-to-ma n y (M:N o r M:M.) 12. Give an exa mp le of eac h of the th ree types of relation sh ip s. 1:1 An ac ademi c d epa rtmen t is chaired b y on e pro f essor; a p rofesso r ma y chai r onl y on e acad emi c department. 1:M A custom er ma y gen erat e man y invoi ces; ea ch in voice is gener ated b y one custom er. M:N An empl o ye e ma y h ave e arned man y d e gre es; a de gr ee ma y h ave be en e arn ed b y m an y empl o yees. 13. Wh at is a tab le, an d w hat role does it p lay i n the relation al mod el? S trictl y spe aking, the re lational data model bas es data stora ge on r elat ions . These relationsare basedonalgebraicsettheory. Howev er, the u ser per ceives th e rel ati ons to be tables.Inthe relationaldatabaseenvir onment, d esigners and u sers perceiv e a table to beamatrixconsistingofa seriesof row/column int ersecti ons. Tabl es, also call ed relations , are rel ate d to each other b y sharing acommonentitycharacteristic.For ex ampl e, an INVO IC E tabl e would co ntain a customernumber thatpointstothatsamen umber in the C USTOME R table . This featur e ena blestheRDBMStolink invoicestothecustom ers who gener ated them. Tables ar e especi all y use ful from the modeling an d im plementation perspececti ves. Bec ause tables areusedtodescribetheentitiesthey repr esent, the y p rovide a n e as y wa y to summ ariz eentity characteristicsandrelationships among enti ti es. And, b ecaus e the y are purel y conceptual constructs,thedesignerdoesnot need to be conce r ned about the ph ysic al im pleme ntation aspects of the database d esi gn.

21


C hapter 2 Data Mod els 14. Wh at is a relation al d iagra m? Giv e an exa mp le . A relational dia gram is a visual rep resent ati on of the r elational datab as e’s enti ti es, the attributes withinthoseentities,andther elations hips betw een those enti ti es. The re fore,itiseasytoseewhat theentitiesrepr esent and to see wh at t yp es of rela ti onshi ps (1:1,1:M,M:N)existamongtheentities and how those relations hips are im plemented. An ex ampl e of a relational diagram is found in the tex t’s Figure 2. 2. 15. Wh at is con n ectivity? ( Use a Crow ’s Foot ERD to ill u strate con n ectivit y.) C onnecti vit y is t he relati onal t erm to describe th e t ypes of relations hips (1: 1, 1:M, M :N).

In the fi gur e, the busi nes ss rule that an adviso r ca n advise man y stud ents a nd a st udent h as onl y one assignedadvisorisshownwithinarelati onshi p with a conn ecti vit y of 1:M. The busi ness rulethata studentcanregisteronlyone vehicle to p ark on c a mpus and a vehicl e can be re gisteredbyonlyone studentisshownwitha relations h ip with a conn ecti vit y of 1:1. Finally,therulethatastudentcan register for man y classe s, and a class can be regist e red forbymanystudents,isshownbythe relations hip wit h a conne cti vit y of M:N. 16. Describ e the Big Data p h en omen on . Over the l ast f ew yea rs, a new wave of dat a has “ emer ged ” to the li meligh t. S uch data hav e alsw a ys exsistedbutdidnotrecivetheattention that is r eceivi n g toda y . Thes e d ata ar e cha ra cterizedfor beinghighvolume(petabytesize a nd be yon d), high fr equenc y (da ta are gen erated alm os t const antl y), and most l y s emi -structured. Thes e da ta come from mul ti ple and vatiedsourcessuchas websitelogs,websitep osts in social sit es, and machine gene rated information(GPS,sensors,etc.) Suchdata; have be en a c cumul ated over th e ye ars and companiesarenowawakiningtothefactthat it contains a lot of hidd en information that could help the da y-to -da y b usiness (such as b rowsi ng patt erns, purch asing p ref erenc es, beh aivor patt ern s, etc.) The n eed to man age and lev er a ge thisdata hastriggeredaphenomenonlabeled “Bi g Dat a”. B ig Data refers to a movement to find newand 22


C hapter 2 Data Mod betterwaystomanagelargeamountsof els web - ge nerated dat a and derive busi ness insi ghtfromit, while,atthesametime,providing hi gh per forma nce and sc alabili t y at a re asonable cost.

23


C hapter 2 Data Mod els 17. W hat does the term “3 vs ” ref ers to? The term “3 Vs ” re fers to the 3 basic cha ra cterist ic s of Bi g Dat a databas es, the y are: Volume: R efers to the a mount s of data being sto red. W it h the adopti on and growth of th e Inte rnet and social m edi a, companies h ave mul ti pli ed the wa ys to rea ch c ustom ers. Over theyears,andwiththebenefitof technologi cal advanc es, data for mi ll ionsofetransactionswerebeingstored dail y on compan y databases. Furthermo re, organizations areusingmultipletec hnologies to int eract with end users and thosetechnologiesare generatingmount ains o f data. This eve r - grow ing volum e of dataquicklyreached petabytesinsize and it 's sti ll growing. Velocit y: R efe rs not onl y to th e spe ed with whi ch data grows but also t o the need to process thes e d ata quickl y in o rder to gen erat e in formation and insi ght. W it h the advent oftheInternetandsocialmedia, busi ness resp onses ti mes have shrun k considerably. Organizationsneednot onl y to store lar ge volum e s of quickl y ac cumulatingdata,butalso needtoprocess such dat a quickl y. The velocit y o f data growthisalsoduetotheincrease inthe number o f diff eren t data stre ams from whic h data is bein g piped to t he or ganiz ati on (via the web, e-comm e rc e, Tweets, Fa cebook post s, em ail s, sensors, GPS , and so on). Variet y: R efe rs to the fa ct that the data bein g coll ected comes in mul ti ple differ entdata formats.Agreatportionofthese data comes in fo rmats not suit able to be handledbythe typicaloperationaldatab ases based on th e relation al m odel. The 3 Vs frame work il lust rates what companie s nowknow,thattheamountofdatabeing coll ected in their datab ases has be en gro wing ex ponenti all y in siz e and co mpl ex it y. Tr adit ional relationaldatabasesaregoodatmana gin g stru ctur ed da ta but ar e not w ell sui ted to managingand processingtheamountsandt ypes of d ata bein g co ll ected in toda y's busi n ess environment. 18. W hat i s Haddop and wha t are it s basic component s? In o rder to cre ate value f rom their previous l y unu sed Bi g Dat a stores, com panies ar e using n ew BigDatatechnologies.Theseemerging technolo gies all ow or ganiz ati ons to process massivedata storesofmultipleformatsin cost -ef fecti ve wa ys . S ome of the most fr eq uentlyusedBigData technologiesareHadoop and MapR educ e. Hadoop is a J ava bas ed, open sour ce, hi gh spee d, fault -tol er ant dist ributed stora geand computationalframework.Hadoop us es low - cost hardwa re to cr eate clust e rs ofthousands ofcomputernodestostore and process dat a. Had oop originated from Google'sworkon distributedfiles ystems a nd parall el processi n g an d is currentlysupportedbytheApache S oftware Foundati on. 2 Ha doop has sev eral modul es, but the two m ain co mponents are Hadoop Dist ributed Fil e S ystem (HD FS ) and M ap R educe. Hadoop Dist ributed Fil e S ystem (H D FS ) is a hi gh l y dist ributed, fault -tol e r ant file storage systemdesignedtomanagelarge amount s of d ata at high sp eeds. In orde r t o achievehigh throughput,HDFSusesthe writ e -on ce, r ead man y model. This mea ns thatoncethedata iswritten,itcannotbe m odified. HDFS uses thr ee t ypes o f nodes: a namenodethatstores allthemetadata about the file s ystem; a dat a nod e that stores fix ed 24


C hapter 2 Data Mod siz e data blocks (that could elsbe r epli cated to other data nod es) and a cli ent node that a cts a s the int erfa ce between th e us er appli c at ion and the HDFS .

2 Fo r mo r e in fo r mat io n ab o ut Had o o p visit had o o p . ap ac he. or g.

25


C hapter 2 Data Mod els MapR educe is an open s ource appli c ati on progra mm ing int erfa ce (AP I) th at providesfast dataanalyticsservices. MapR educe dist ributes the processi ng of thedataamong thousandsofnodesinpa rall el. MapR edu ce works with st ructured andnonstructureddata. TheMapReducefr amew ork provides two main f uncti ons, Map andReduce.Ingeneral terms,theMapfun cti on takes a job and divi des it int o smallerunitsofwork;theReduce functi on coll ects all t he o utput result s gen erated fr om t he nodes and int e gr a tes them i nto a single r esult set.

19. Wh at is sp arse d ata? Gi ve an exa mp le. S parse data re fers to cas es in which the number of att ributes a re v er y la r ge, but the numbe rs butthe actualnumberofdistinctvalueinst ances is rel ati v el y sm all . For ex ampl e, if you a remodelingcensus data,youwillhaveanenti tt y call ed pe rson. This enti t y pe rson can h ave h undredofattributes,some ofthoseatt ributes would be first name, last n ame, degre e, empl o yer, in co me, vetera n status, forei gn born, etc. Although, ther e would be man y mi ll ions of rows of d ata fo r e ach pe rson, the re will b e manyattributesthatwillbeleftblank,for ex ampl e, not all pe rsons will ha ve a d e gre e, an incomeor anemployer.Evenfewerpersonswill be veterans or forei gn born. Ever y ti me that you haveandata entitythathasmanycolumnsbut the data inst a nces fo r the colum ns a r e ver y low (manyempty attributeoccurrences)itissaid that you hav e spars e data. There is another related termi noli gy, data spar ci t y th at r efe rs to the number of different valuesa fivencolumnscouldhave.Inthis case, a colum n such as “gend er” alt hou gh it will havevaluesfor allrows,ithasalowdata sparcit y b ecaus e the number of different valuesisonytwo:maleor female.Acolumnsuch as name and birthd ate w il l have hi gh data spar ci tybecausethenumberof differentvaluesishi gh. 20. Def in e an d d escrib e the basi c ch aracte ristics of a NoSQ L d atabase. Ever y ti me you sea rch fo r a product on Am az on, send messa ges to f riends i n Fac ebook, wat ch a video in YouTube or se ar ch for dire cti ons i n Google Maps, you ar e usi ng a NoSQ L d atabase. NoSQ L refers to a n ew generati on of d atabas es that address t he v er y spe cif ic chall en ges o f the “bi g data” e ra and h ave the fo ll owing gene ral ch ara cter ist ics: Notbasedon the r elational model . These datab ases a re gen e rall y b ased on a v ariati on of the ke y-v alue data mo del rather th an in t he relational model, henc e t he NoSQ L name . Th e ke y-valu e data mod el i s based on a structur e compos ed of two data ele ments: a ke y and a v alue; in which for ev er y ke y t here is a correspondi n g v alue (or a set of values ). The ke y- value data model i s also r efer red to as the att ribute-value or associa ti ve data model. In the ke y- v alue data mod el, ea ch row rep resents on e att ribute of one enti t y inst ance. The “ke y” colum n point s to an att ribute and the “value ” colum n contains t he actual v alue for the att ribute. Th e data t ype of th e “valu e” colu 26


C hapter 2 Data Mod mn i s gene rall y a lon g string toels ac comm odate th e variet y of actual dat a t ypes of the values that are placed in t he colum n. Supportdi stribut ed database ar chit ectur es . One of the bi g adv anta ge s of NoS Q L d atabas es is that the y gener all y us e a dist ributed

27


C hapter 2 Data Mod els archit ectu re. In fact, sev e ral of them (Cassand ra, Big Table) ar e desi gned t o use low cost comm odit y serv ers to for m a compl ex network of dist ributed database node s Providehighscalabilit y, high av ail abil it y and f aul t t olerance . NoSQ L d atabases are d e signed to s upport t he abil it y to add c apacit y ( add d atabase nod es to t he dist ributed database) whe n the demand is hi gh and to do i t t ransparentl y an d without downtim e. Fault tol erant m e ans t hat i f one of the nodes in t he dist ributed database f ail s, the database will keep oper ati ng as normal . Supportveryl ar ge amount s of sparse dat a . Bec ause NoSQ L d atabas es use the ke y- value dat a model, the y are sui ted to handle ver y hi gh volum es of sparse d ata; that is for cas es wher e the number of att ributes is v er y lar ge but t he number of a ctual data ins tances is low. Gearedtowardperforma nce rath er than tr ansacti o n co nsis tenc y. One of the bi ggest proble ms of ver y lar ge dist ributed databas es is to enforc e data consi stenc y. Dist ributed databases autom ati call y mak e copies o f data elem ents at m ult iple nodes – to ensur e high av ail abil it y and f aul t t olerance. If the node w i th t he requested dat a goe s down, the request can be se rved f rom an y o ther node with a cop y o f the data. How ever, what happen if the netwo rk goes do wn durin g a dat a update? In a rel ati onal da tabase, trans acti on updat es are gu arant eed to be consi stent or the trans acti on is rolled back. No S Q L data bases sa crific e consi stenc y in order to att ain hi gh lev els of per f ormance. NoSQ L d ataba ses provide ev entual con sis tenc y. E ven tual con sis ten cy is a fe ature o f NoS Q L d atabas es that i ndicates that data are not gua rante ed to be consi stent i mm ediatel y a fter an upd ate (a cross all copies of the dat a) but rat her, that updates will propa gate throu gh th e s ystem and eventuall y all d ata copies wil l be consi st ent.

21. Usin g the exa mp le o f a med ical cli n ic w ith p atientsandtests,provideasimple represen ta tion of h ow to mod el this exa mp le u sin g the relationalmodelandhowitwoldbe represent ed u sin g the key -valu e d ata mod eli n g tech n iq u e. As you can se e in Fi gur e Q2.21, the relational mo del st ores data in a tabul a r format i n which e ach rowrepresentsa“record�foragivenpati ent. W hil e, the ke y-valu e data mo del uses threediffernet fieldstorepresenteachd ata element i n the r ecord. Therefo re, fo r e ach pati e nt row, there are thr ee

28


C hapter 2 Data Mod els rows in t he ke y-v alue model.

22. Wh at is logi cal i nd ep end en ce? L ogical in d ep end en ce ex ist s when you can c hange the int ern al model without affe cti ng th e conceptual model. W hen you discuss logic al and other t yp es of independen ce, it ’s worthw hil e to discuss and review some basic modeli ng con cepts and term inol o g y: In gene ral te rms, a mode l is an abstr acti on of a m ore compl ex re al -world object or event.A model’smainfunctionistohelp you under stand the compl ex it ies of the r eal -world environment.Withinthedatabase environment, a data mod el r epres ents d a ta structuresand theircharacteristics, relat ions, const raint s, and transformations. As it s name im pli es, a purely conceptualmodelstandsatthehi ghest level o f abstracti on and focus es on thebasicideas (concepts)thatareex plored in the model, withou t specif yin g the detailsthatwillenablethe designerto implement t he model. For ex ampl e, a conc eptualmodelwouldincludeentities and their relations hips and it ma y even include a t least some of the att ributes that define the entities,butitwouldnotincludeatt ribute detail s such as the nature of t he att ributes(text, numeric,etc.)orthephys ical st ora ge r equireme nts of thos e att tribut es. The terms data model a nd databas e mod el ar e often used int erch an gea bl y. In the t ex t , the termdatabasemodelisbeusedtorefer to the i mpl ementati on of a data model in a specific database s ystem .

29


C hapter 2 Data Mod Data mod els (rel ati vel y simelsple rep resentations, usuall y graphi cal, o f m ore complexrealworlddatastructures),b olst ered b y powe rful database desi gn tool s,havemadeitpossibleto substantially dim ini sh t he potential for e rrors in d atabase d esign.

30


C hapter 2 Data Mod els The in tern al mod el is the repres entation of the database as “s een” b y th e DBMS . In other words, the int ernal model requires the designe r to match the conceptual model’s chara cterist ics and const r aint s to t hose of the selec ted impl ementati on model. An in tern al sche ma dep icts a specific rep resentat ion of an int ernal m odel, using the database constructssupportedbythe chosen dat abase. The ext ern al mod el is t he end users ’ view of th e data environment. 23. Wh at is p h ysical in d ep en d en ce? You have p h ysical in d ep en d en ce when you can chan ge the physi cal mo del without aff ecti n g the internalmodel.Therefore,achangein stor a ge d evices or methods and e ven a chan ge in operating systemwillnotaffecttheinternal m odel. The terms ph ysical m ode l and internal m odel m a y require a bit of addit iona l di scussi on: The p h ysical mod el ope rates at the lowest level of abstracti on, desc ribing the wa y d ataare savedonstoragemediasuchasdisks or tapes. Th e ph ysic al model require s the definitionof boththephysicalstorage devices and th e (ph ysic al) ac cess m ethods r equiredtoreachthedata withinthose storage d evices , makin g it both software - and ha rdwar e-d ep endent. The stora ge structures used are depen dent on the softwa re ( D BMS , operati n g s ystem) and on the t ype o f storagedevicesthatthecomputercan handle. The precisi on required in the ph ysi calmodel’s definitiondemandsthat database desi gne rs who work at thi s level h aveadetailedknowledge ofthehardware and soft ware us ed to i mpl ement the databas e desi gn. The in tern al mod el is the repres entation of the database as “s een” b y th e DBMS . In other words, the int ernal model requires the designe r to match the conceptual model’s chara cterist ics and const raint s to those of the sel ected im plementation m odel. An in ternal schemadepictsaspecificrepr esentation of an int ernal model, using the d atabaseconstructs supportedbythe chosen database.

31


C hapter 2 Data Mod els

Pro blem So l utio ns Use the con t en ts of Figu re 2. 1 to w ork p rob lems 1 -3. 1. Write the bu sin ess rul e(s) that govern s the r elat ion sh ip b etw een AGE NT an d CUS T OMER. Given the data in the two tables, you can s ee that an AGENT – th rou gh A GENT_C ODE -- can occu r man y ti me s in the C USTOMER table. But each custom er has onl y on e agent. the rules, bus iness ma y be wthritten as follows: Given Ther theseefor busie,ness you rules c an conclude at there is a 1:M relations hip between One a gent can hav e man y custom e AGENT and C USTOME R . rs. Each custom er h as onl y one a 2. Given the b ugent. sin ess rul e(s) you w rote in Prob le m 1, crea te the basi c C r ow ’s Foot ERD The C row’s Foot ER D is shown in Figu re P 2.2a. .

Fi g ure P2 . 2a The Crow ’s Fo o ERD fo r Pro blem 3 t

AGEN T

se r ve s

CU S TO M ER

which conne cti vit ies (1,M) are repr esented. Th e C hen ERD is shown in Figure P 2.2 b.

Fi g ure P2 . 2b The Chen ERD for Pro bl em 2 For discussi on purpose s, you mi ght use th e C hen mo del shown in Fi gur e P 2.2b . C ompare the two rep res entations of the busi ness rules b y noti n g the dif f erent wa ys in

Chen mo de l 1M AGEN T

se r ve s

27

CU S TO M ER


C hapter 2 Data Mod els 3. Usin g the E RD you d rew in Prob lem 2, crea te the eq u ival en t Ob ject r ep resen tation an d UM L class d iagram. ( Use Fig u re 2. 4 as you r gu id e.) The OO model is shown in Figu re P 2. 3.

Fi g ure P2 . 3a The OO Mo del f o r Pro bl em 3

AGEN T M CU S TO M ER

Fi g ure P.3b The UML Mo del fo r Pro blem 3

Usin g Figu re P2. 4 as y ou r gu id e, w ork Prob lems 4– 5. T h e DealCo r e lation al d iagram sh ow s the in itial en tities and attrib u tes f or the DealCo st ores, locat ed in tw o region s of the cou n try.

Fi g ure P2 . 4 The De a l Co r ela tio nal diagra m

28


C hapter 2 Data Mod els 4. Id en tif y each relation ship type and w rite all of th e b u sin ess rul es. One re gion can b e the lo cati on for m an y stores. E ach store is located in on l y one re gion. Th ere fore, therelationshipbetweenREGIONandS TOR E is 1:M. Each stor e empl o ys on e or more empl o ye es. Ea ch empl o ye e is empl o yed b y one store. ( In thi s case, weareassumingthatthebusinessrule specifies that an empl o yee canno t work in more thanone storeatatime.)Therefore,the relations hip betw ee n S TOR E and EMP LOY EE is 1: M. A job – such as accountant or sales represent ati ve--canbeassignedtomanyemployees.(For ex ampl e, one would rea sonabl y assum e that a st ore can h ave mor e than one sales rep resent ati ve. Therefo re, the job ti tl e “S ales R epr esentative ” c an be ass i gned to more than one employeeata time.)Eachemployeecanhaveonl y on e job assignment. ( In thi s case, we are assum ingthatthe businessrulespecifiesthatan empl o yee c annot have more than one job assi gnmentatatime.) Therefore,therelationshi p be tween J OB and EMP LO YEE is 1: M. 5. Creat e the basi c Crow s Foot ERD or D ealCo. f The C row’s Foot ERD is s’ hown in Figu re P 2. 5a.

Fi g ure P2 . 5a The Crow ’s Fo o ERD fo r Dea l Co t is loc at io n f or REG IO N S TO RE

e mplo ys

JO B

is a ssig ne d t o

EM P LO YEE

The C hen model is show n in Fi gur e P 2. 5b. (Note that you alw a ys r ead the relations hip from the “1” to t he “M” side.)

29


C hapter 2 Data Mod els

Fi g ure P2 . 5b The Chen ERD fo r Deal Co 1M REG IO N

S TO RE

is loc at io n f or

1

e mplo ys M

1M JOB

is a ssig ne d t o

EM P LO YEE

Usin g Figu re P2. 6 as you r gu id e, w ork Prob lems 6−8 T h e T in y College relation al d iagram sh ow s the in itial en tities and attrib u t es f or T in y College.

Fi g ure P2 . 6 The Ti ny Co ll eg e r ela tio na l di ag ra m 6. Id en tif y each relation ship type and w rite all of th e b u sin ess rul es. The sim plest wa y to il lu strate the relations hip be tween ENR O LL, C LASS , and S TUDENT is to discuss the dat a shown i n Table P 2. 6. As you ex ami ne the Table P 2. 6 co ntents and compar e the att ributes to relational sc hema shown in Fi gur e P 2. 6 , note these fe atures: W e have added an att ribu te, ENR O LL_S EMES TER, t o identif y the enrollm ent period. Naturall y, no grade has yet be en assi gned whe n the student is first en rolled, so we have enteredadefaultvalue“NA”for“Not Applicable.” The letter gr ade – A, B, C , D, F, I (Incomplete),orW(Withdrawal)--will be ent ered at the conclusi on of the enrollm ent period, the SP R ING -12 s em ester. 30


S tudent 11324 is en rolled in two classes; stude nt 11892 is en rolled in three classes, and student 10345 i s enrolled in one class.

31


C hapter 2 Data Mod els

Ta bl e P2.6 Sa mpl e Co ntents of a n ENROLL Ta bl e S T U_NUM 11324 11324 11892 11892 11892 10345

CLASS _CODE MATH345 -04 ENG322-11 C HEM218 -05 ENG322-11 C IS 431 -01 ENG322-07

E NROL L _S E MES T E R S P R IN G -1 4 S P R IN G -1 4 S P R IN G -1 4 S P R IN G -1 4 S P R IN G -1 4 S P R IN G -1 4

E NROL L _GRADE NA NA NA NA NA NA

All of the relations hips ar e 1:M. The relations hips ma y b e writ ten as follow s: C OUR S E gener ates C LAS S . One course can ge nerate man y classes. Ea c h class is gene rated b y o ne course. C LASS is ref eren ced in ENR O LL. One class ca n be re fer enc ed in enrol lm ent man y ti mes. E ach indi vidual enrollm ent refer enc es one cl ass. N otethattheENROLLentityisalsorelatedto S TUDENT. Ea ch entr y i n the ENR O LL enti t y re feren ces on e student and the class for which that student has enrolled. A s tudent cannot enroll in the same class mor e than once. If a student enrolls infourclasses,thatstudentwill appear in the EN R O LL enti t y four ti mes, each ti me for a differe nt class. S TUDENT is shown in ENR O LL. One student can be showninenrollmentmanytimes.(In database 7. Creat e the basi c Crow s Foot ERD or T in y Co ll desi gn te rms, “ man y” egesim pl y means “ m ore than onc e.” ) Ea ch in divi dual enrollm ent ent r y shows one student. The C row’s Foot m odel i s shown in Figu re P 2. 7a. ’f.

Fi g ure P2 . 7a The Crow ’s Fo o Mo del for Ti ny Co ll eg e t CO UR SE

g e ne rat es

CL ASS

is re f e re nc e d in

is sh o wn in S TUD EN T ENR O LL

The C hen model is shown in Figu re P 2. 7b. 31


C hapter 2 Data Mod els

Fi g ure P2 . 7b The Chen Mo del for Ti ny Co ll ege 1M CO UR SE

CL ASS

g e ne rat es

1

is re f e re nc e d in M

1M S TUD EN T

is sh o wn in

ENR O LL

8. Creat e the U ML class d iagram that ref lec ts t h e en tities an d relation sh ip s you id en tified in the relation al d iagram. The OO model is shown in Figu re P 2. 8.

Fi g ure P2 . 8a The OO Mo del for Ti ny Co ll eg e CO UR SE

S TUD EN T

ENR O LL

CR S_ CO DE

C

CR S_ DESCR IP TIO C N CR S_ CR ED IT N

ENR O LL_ S EM ES TER C ENR O LL_ GR ADE C

CL ASS ES: M

CL AS SES:

M

CL ASS

CL ASS S TUD EN TS:

S TU_ NU M S TU_ LN AM E

CL ASS

C C

C

CL ASS_ D AYS

C

S TU_ F NAM E C

CL ASS_ TIM E C CL

STU_IN ITIALC S

ASS_ RO O M C

TU_ DO B D

CO UR SES: 1

ENR O L LM EN T:

M

CL ASS_ CO DE

M

S TUD EN T

CO UR SE

ENR O LL

Not e : C = Cha r ac t er D = D at e N = Nu me ric

ENR O L LM EN T: M ENR O LL

Fi g ure P2 . 8b The UML Mo del fo r Ti ny Co ll ege

32


C hapter 2 Data Mod els

9. T yp ically, a p atien t sta yin g in a h osp ital rece ives med ication s that h ave b een ord e red b y a p articu lar d octor. B eca u se the p atien t of ten receives seve ral med icati on s p er d ay, there is a 1:M r elation sh ip b etw een PATIE NT an d ORDER. S imil arly, ea ch ord er can in clu d e severa l med ication s, crea tin g a 1:M rela tion sh ip b etw een ORDER an d ME DICATIO N. a. Id en tif y the bu sin ess rules f or PATIE NT, O RD E R, and ME DICATION. The busi ness rules r eflect ed in thePAT IENT des cr ipt ion are: A pati ent can h ave man y (medical) ord ers w ritten for him or her. Each (medi cal) ord er is writ ten for a sin gle p ati e nt. The busi ness rules r efe cted in the OR DER descrip tionare: Each(medi cal) ord er c an prescribe manymedications. Each medic ati on can be prescribed in m an y o rder s. The busi ness rules r efe cted in the MED IC AT IO N descriptio n are: Each medic ati on can be prescribed in m an y o rder s. Each (medi cal) ord er c an prescribe m an y medicati ons. b. Creat e a C row 's Foot E RD that d ep icts a re lation al d atabase mod e l to cap ture these b u sin ess rul es .

Fi g ure P2 .9 Crow 's foot ERD for Probl em 9

10 . Uni ted B rok e Artists ( UBA) is a b rok er f or not -so-famouspainters.UBAmaintainsasmall n etw ork d atabase to track p ain ters, p ain tings, andgalleries.Apaintingispaintedbya p articu lar artist, an d t h at p ain tin g is exh ib ited in a p articu lar gall ery. A gall ery can exh ibit manypaintings,buteachpaintingcanbe exh ib ited in on ly on e gall er y. S i mil arly, a p ainting ispaintedbyasinglepainter,but each p ain ter can p ain t man y p ain tin gs. Usin g PAINTER, PAINTING,andGALLERY,intermsofa relat ion al d atabase: a. Wh at tab les w ou ld you creat e, an d w h at w ou ld the tabl e co mp on en ts be? W e would create the th ree tables shown in Fi gure P 2.10a. (Use the te a cher’s Ch02_ UBA 33


C hapter 2 Data Mod database in your instru ctor's resour els ces to i ll ustrate the table contents.)

34


C hapter 2 Data Mod els

FI GURE P2 .10a The UBA Da ta ba s e Tabl es

As you discuss the UBA database contents, note in particular the following busi ness rules that arereflectedinthetablesandtheir contents: A paint er c an paint ma y paint ings. Each paint in g is paint ed b y onl y one p aint er. A gall er y c an ex hibi t m an y paint in gs. A paint er can ex hibi t p aint ings at more than one gall e r y at a ti me. (For ex ampl e, if a painterhaspaintedsixpaintings,two ma y be ex hibit ed in one gall er y, one at another,and threeatthethirdgallery. Naturall y, if gall e ries specif y ex clusi vecontracts,thedatabase mustbechan ged to r efle ct t hat busi ness rule.) Each paint in g is ex hibi ted in o nl y one gall e r y. The last busi ness rule r eflects the fact th at a p aint ing c an be ph ysic all y loc ated in onl y one gall e r y at a ti me. If the paint er decid es to move a paint ing to a di ffe ren t gall er y, th e database mustbeupdatedtoremovethepaint ing from on e gall e r y and add it to t he d ifferent gall er y. b. How migh t th e (in d ep en d en t) tabl es b e related to one another? Figu re P 2.1 0b shows the relations hips. 35


C hapter 2 Data Mod els

FI GURE P2 .10b The UBA Rel a tio na l Mo del

11. Using the ERD from Problem 10, create the relational schema. (Create an appropriate collectionof attributesforeachofthe entities. Make sure you use the appropriate naming conventions to name the attributes.) The relational dia gram i s shown in Figu re P 2. 11.

FI GURE P2 .11 The Rel a tio nal Dia gra m fo r Probl em 11

12. Convert th e E RD f ro m Prob le m 1 0 in to th e cor resp on d in g UML class d iagram. The basic UM L solut ion i s shown in Figur e P 2. 12.

FI GURE P2 .12 The UML fo r Pro bl em 12

36


C hapter 2 Data Mod els 13 . Describ e the rela tion sh ip s (id en tif y the bu sin ess ru les) d ep icted in the Cr ow ’s Foot E RD sh own in Figu re P2. 13.

Fi g ure P2 . 13 The Crow ’s Fo o t ERD fo r Pro blem 13 The busi ness rules ma y b e writ ten as follows: A professor can te ach ma n y cl asses. Each class is tau ght b y o ne professo r. A professor can advise man y stude nts. Each st udent i s advised b y one p rofesso r. 14 . Creat e a Crow ’s Foot E RD to in clu d e the f oll ow in g b u sin ess rul es f or the Prod Co co mp an y: a. E ach sal es rep resen tati ve w rites man y in voices. b. E ach in voice is w ritten b y on e sal es rep resen tat ive. c. E ach sal es rep resen tati ve is as sign ed to one dep art men t. d. E ach d ep artmen t has man y sal es rep resen tativ e s. e. E ach cu stomer can gen erate man y in voices. f. E ach in voice is generated b y on e cu stomer. The C row’s Foot ERD is shown in Figure P 2.23. Note that a 1:M relationshi p is alwa ys read f ro m the one (1) to the many (M) side. Ther efor e, the custom er -invoi ce r elations hip is read as “one custom er gene rates man y invoi ces.” 37


C hapter 2 Data Mod els

Fi g ure P2 . 14 Crow ’s Fo ot ERD fo r the Pro dCo Co mpa ny

15. Write the b u sin ess ru les that are ref lected in theERDshowninFigureP2.15.(Notethatthe E RD ref lects so me si mp lif yin g assu mp tion s. For example,eachbookiswrittenbyonlyone au thor. Also, re me mb e r that the E RD is alw ays read fromthe“1”tothe“M”side,regardless ofthe orientation of the E RD co mp on en ts.)

FI GURE P2 .15 The Crow ’s Foo t ERD for Pro blem 15

The relations hips ar e bes t described throu gh a s et of business rules: One publi sher c an publi sh m an y books . Each book is publi shed by one publi she r . A publi sher can subm it man y (bo ok) contr acts . Each (book) contra ct i s subm it ted b y one publi she r. One author c an si gn man y contr acts . Each con t r act i s si gn ed b y one author. One author c an writ e m a n y books. 38


C hapter 2 Data Mod Each book is writ ten b y one author. els

39


C hapter 2 Data Mod els This ERD will be a good basis for a discussi on ab out what happ ens wh en more r eali sti c assum pti ons aremade.Forexample,abook–suchasthis one – ma y be w ritten by more than one author . Therefo re, a contr act ma y b e si gned b y mor e than one author. Your studen ts will learn how to mod el suchrelationshipsaftertheyhavebecomef ami li ar wit h the material in C hapter 3. 16. Creat e a Crow ’s Foo t E RD f or each of the f oll ow in g d escrip tion s. ( Note: T h e w ord m an y merely mean s “ mor e th an on e” in the databas e mod eli n g en viron men t. ) a. E ach of th e MegaCo C orp oration ’s d ivi sion s is comp osed of man y d ep art men ts. E ach of those d ep artmen ts h as man y e mp loyees assi gn edtoit,buteachemployeeworksforonly The Cep row’s is shown re tPis2. man 16a. aged b y on e e mployee,andeachofthose oned art Foot men ER t. ED ach d ep in artFigu men managerscanman age on ly on e d ep artmen t a t a time.

FI GURE P2.16 a The Meg a Co Crow s Fo o ERD ’t EM P LO YEE

is a ssig ne d t o

man ag e s

DEP AR TM EN T

As you discuss the conte nts of Fi gur e P 2. 16a, not e the 1:1 r elations hip bet ween the EMP LOYEE andtheDEPARTMENTinthe“manages”r elation ship and the 1:M relations hip between the DEPARTMENTandtheEMPLOYEEinthe“isa ssi gned to” relations hip.

40


C hapter 2 Data Mod els b. Durin g some p eriod of ti me, a cu sto mer can d ownl oad man y eb ook s f rom B ook sOn lin e . E ach of the eb ook s can b e d ownl oad ed b y many cu sto mers d u rin g th at p eriod of time. The sol uti on is presented in Fi gure P 2. 16b. Note t he M:N r elations hip between C USTOMER an d EBOOK. S uch a r elations hip i s not im plementable in a relational model .

FI GURE P2.16 b The Bi g Vi d Crow ’s Foo t ERD

If you want to let the stud ents convert Fi gure P 2. 1 6b’s ERD int o an im plementable ERD, add a thi rd DOW N LOA D enti ty to cr eate a 1:M rel ati onshipbetweenCUSTOMERandDOWNLOAD anda 1:M relations hip b etween EBOOK and DO W N LOAD . (Notethatsuchaconversionhas beenshownin t he nex t pr oblem sol uti on.) c. An airlin er can b e assi gn ed to f ly man y f li gh ts, b u t each f li gh t is f low n b y on ly one airlin er.

FI GURE P2.16 c The Ai rli ne Crow ’s Foo t ERD I nit ial M: N Sol uti on f lie s

AIRC R AF T

F L IGH T

I mpl e ment abl e Sol ut i on AIRC R AF T

is a ssig ne d t o

sho ws in ASS IG NM EN T F L IGH T

W e have cre ated a small Ch02_Airlin e database to let you ex plore th e im p lementationofthe model.(Checkthedataf il es avail able for Inst ruct ors at www.c en gagebrain.com.)Thetables andthe relational dia gra m are shown in t he follo wing two fi gur es. 41


C hapter 2 Data Mod els

FI GURE P2.16 c The Ai rli ne Da ta ba se Ta bl es

FI GURE P2.16 c The Ai rli n e Rela ti onal Di ag ra m

42


C hapter 2 Data Mod els d. T h e Kw ik Tite Corp ora tion op erates man y f actories. E ach f actory is located in a region . E ach region can b e “h ome” to man y of Kw ik T ite’s f actories. E ach f actory e mp loys man y e mp loyees, b u t each of those e mp loyees is e mp l oyed b y on ly on e f actory.

FI d The KwreiPkTi te Crow s Fo o ERD TheGURE sol uti onP2.16 is shown in Figu 2. 16d. ’t EM P LO YEE Re me mbe r t hat a 1 : M re lat i onshipisalwaysreadfrom t he “ 1 ” side t o t he “ M ” side . The re f o re , t he re lat i onsh ip betweenFACTORYandREG IONisproperlyreadas “fac t or y e mpl o ys e mplo ye e .”

e mplo ys

c ont ain s

REG IO N

F AC TO RY

e. An emp loyee may h ave earn ed man y d egre es, an d each d egree may h ave b een earn ed b y man y e mp loye es. The sol uti on is shown in Figu re P 2. 16e.

FI GURE P2.16 e The Ea rned Deg ree Crow ’s Foo ERD t EM P LO YEE

ea rns

DEGR EE

Note that thi s M:N relationshi p must be broken up int o two 1:M relations hips before it can be im plemented in a relatio nal database. Use the Air li ne ERD’s decompo sit ion in Figur e P 2. 16c as the focal poi nt i n you r di scussi on.

41


C hapter 2 Data Mod els 17. Write the bu sin ess rul es that are r ef lected in the ERD sh ow n in Figu re P2.17. A theater show m an y movi es. A movie can be sho wn in man y the ater s . A movie can r eceiv e man y r eviews. Each r eview is for a singl e movi e. A review er c an writ e ma n y r eviews. Each r eview is writt en b y a single review er. Note that the M:N rela ti onshi p between th eate r and movi e must be broken int o two 1:M relations hips u sing a brid ge t able befo re it can b e i mpl emented in a relation al database.

42


Appendix B The University Lab: C onceptual Design

A ppendix B The Univers ity Lab: Conce ptual De sign Discu ssion Focu s Wh at action s are taken d u rin g the d atabase in itial stud y, an d w h y are those action s imp ortant to the d atabase design er?

NOTE We recommen d that you u se App en d ix B ’s T ab le B.1, “ADatabaseDesignMapfortheUniversity Compu ter L ab (UCL),” in this an d all su b seq u en t d iscus sionsaboutthedesignprocess.Thedesign p roced u re su mmary sh ou ld b e u sed as a temp late in all d esign an d imp lemen tation exercises, too. S tud en t f eed b ack in d icates that this b lu ep rin t is esp ecial ly h elp f u l w h en it is u sed in con jun ction withclassprojects.UseAppendixB’s Figu re B.4, “T h e E R Mod el S egmen t f or B u sin ess Rule 1,” to il lu strate h ow the databas e d esign map w as u sed to gen erate the in it ial E R di agram.

The database ini ti al study is essentially a process based on data gathering and analysis . C arefullyconducted andsystematicinterviews usuall y const it ute an im portant part of thi s process. The ini ti al st udy must take it s cues from an organiz ati on's key end u sers. Therefore, one of thefirstinitial studytasksistoestablishwho the organiz ati on's key end users are. Once the key endusersareidentified,the initialstudymust be conducted to establis h the foll owing output s: objecti ves organiz ati onal st ructu re descriptio n of operati ons definiti on of problems and const raint s descriptio n of system obj ecti ves definiti o n of system scope and boundaries The database designer cannot ex pect to develop a usable design unless these output s are carefully defined anddelineated.Theimportanceof having such a li st of output s is self -ex planatory.Forexample,adatabase designisnot li kely to be useful unless and unti l it accompl ishes specific objecti ves and helps solve an organiz ati on's problems. The inherent assum pti o n is that those problems are usuall y based on the lack of useful and ti mely information.

507


Appendix B The University Lab: C onceptual The value of having suchDesign a li st of required output s is clear, too, because thi s li st const it utes a checklisttobe usedbythedatabasedesigner. The designer shoul d not proceed with the database designuntilalltheitems onthislisthavebeen compl ete d.

508


Appendix B The University Lab: C onceptual Design Wh at is th e p u rp ose of the con cep tual d esign p h ase, an d w h at is its en d p rod u ct? The conceptual design phase is the first of three database design phases: concept ual, logical, andphysical. Thepurposeoftheconceptual design phase is t o develop t he following output s: information sources and users Information needs: us er requirements the init ial ER model the definiti on of att ributes and domains The conceptual des ign's end product i s the ini ti al ER diagram, which const it utes the preli mi nary database blueprint.Itisveryunlikelythat useful logical and physical designs can be producedunlessanduntilthis blueprinthas been compl ete d. Too much "design" acti vit y takes place without the benefit of a carefully developed database blueprint. Implementingadatabasewithouta good database blueprint alm ost invariably producesalackofdata integritybasedon various data anomalies. In fact, it may easil y be arguedthatimplementingasuccessful database without a good database blueprint is just as li kely as writ ing a great book by stringing randoml y selected words together. Wh y is a n in itial ER mod el n ot lik ely to b e the basi s f or the imp lemen tation of the databas e? ER modeling is an it erati ve process. The ini ti al ER model may establis h many of the appropriate entitiesand relationships,butitmaybeim possi ble to im plement such relations hips. Also, giventhenatureoftheER modelingprocess,itis very li kely that the end users begin to develop a greaterunderstandingoftheir organization's operati ons, thus making it possi ble to establis h addit ional enti ti es and relationships. In fact, it maybearguedthatoneveryimportantbenefit of ER modeling is based on the fact that it is an outstanding communicationstool.Inanycase,b efore the ER model can be im plemented, it must be carefullyverified withrespecttothebusiness transacti ons and information requirements. (Notethatstudentswilllearnhowto developthe verificati on process i n Appendix C .) C learly, unless and unti l the ER model accurat ely reflects an organization's operations and requirements,the developmentoflogicaland physical designs is premature. After all , the databaseimplementationisonlyas goodasthe final ER blueprint all ows it to be!

509


Appendix B The University Lab: C onceptual Design

An sw ers t o Review Quest ions 1. Wh at f actors relevant to d atabase design are u n covered d u rin g the in itial stud y p h ase? The database ini ti al study phase yields the information required to determi ne an organiz ation'sneeds,as wellasthefactorsthat influence data generati on, coll ecti on, and processing.Studentsmustunderstand that thi s phase is generall y concurrent with the planning phase of the S DLC and that, therefore, several oftheinitialstudyactivitiesare comm on to bot h. The most im portant discovery of the ini ti al study phase is the set of the company's objecti ves.Oncethe designerhasaclear understanding of the company's main goals and itsmission,(s)hecanusethisasthe guideto making all subsequent decisi ons concerning the analysis , design, and im plementation of the database and the informati on system. The ini ti al study phase also establis hes the company's organiz ati onal structure; the descriptionof operations,problemsand const rai nts, alt ernate solut ions; system objectives;andtheproposedsystem scopeand boundaries. The organiz ati onal structure and the descriptio n of operati ons are int erdependent becauseoperationsare usuallyafunctionof the company's organiz ati onal structur e. The determinationofstructureand operations all ows the designer to analyz e the ex ist ing systemandtodescribeasetofproblems, const raint s, and possi ble solut ions. Naturall y, the designer must find a feasibl e solut ion withi n the ex ist ing const rain ts. In mostcases,the bestsolutionisnot necessaril y the most feasibl e one. The const raintsalsoforcethedesignertonarrow the focus on very specific problems t hat m ust be solve d. In short, the combi nati on of all the factors we have just discusse d help the designer to put togetheraset ofrealistic,achievable,and measurable system objecti ves withi n the system's required scope and boundaries. 2. Wh y is th e organ ization al stru cture relevant to the databas e d esign er? The deli very of information must be ti mely, it must reach the right people, and the delivered information mustbeaccurate.Sincethe proper use of ti mely and accurate information isthekeyfactorinthesuccess ofanysystem, the reports and queries drawn from the database mustreachthekeydecisionmakers withinthe organiz ati on. C learly, understanding the organization structure helps the designer to definethe organization'slinesofcomm unicati on and to establi sh reporting requirements. 3. Wh at is the d if f eren ce b etw een the d a tabase d esign scop e an d its b ou n d aries? Why is th e scop e an d b ou n d ary statemen t so imp ortant to the databas e d esign er? 510


Appendix B The University Lab: C onceptual Design The system's boundaries are the lim it s im posed on the database design by ex ternal const raint s suchas availablebudgetandtime,thecurrent level of technology, end -user resis tance to change,andsoon.The scopeofadatabase defines the ex tent of the database design coverage and reflects a conscious decisi on

511


Appendix B The University Lab: C onceptual Design to include some thi ngs and ex clude others. Note that the ex ist ence of boundarie s usually has an effect on the system's scope. For legal and practi cal design reasons, the designer cannot afford to work on an unbounded system.Ifthe system'slimitshavenotbeen adequately defined, the designer may be legall yrequiredtoexpandthe systemindefinitely. Moreover, an unbounded system will not contain thebuilt-inconstraintsthatmake itsuse practi cal in a real -world environment. For ex ample, a completely unbounded system will never be completed,normayiteverbereadyfor reasonable use. Even a system with an "optimistic"setofbounds maydragthedesign out over many years and may cost too much. Keep in mindthatcompanymanagers almostinvariably want l east -cost s olut ions t o specific problems. 4. Wh at bu sin ess rul e(s) an d relatio n sh ip s can b e d escrib ed f or the ERD in Figu re Q B.4?

Figu re QB.4 Th e ERD f or Quest ion 4

The busi ness rules and relations hips are sum mariz ed in Table Q B.4

Tab le QB.4 Bu sin ess Ru les an d Relat ionsh ips S u mmary Bu sin ess ru les

Relat ionsh ip s

A suppli er suppl ies many parts . Each part is s uppli ed by many suppl iers. A part is us ed in m any products . Each product i s compos ed of many parts.

many to m any P ART - S UPP LIER many to m any P R ODUCT - P ART

512


Appendix B The University Lab: C onceptual A product i s bought by many custom ers . many to m any Design Each custom er buys many prod ucts. P R ODUCT - C USTOMER

513


Appendix B The University Lab: C onceptual Design Note that the ERD in Figure QB.4 uses the P ART_P R OD, P R OD_VEND and P R OD_C UST enti ti es to convert the M:N relations hips to a series of 1:M relations hips. Also, note the use of two compos it e enti ti es: The P ART_VEND en ti ty’s compos it e P K is VEND_ID + P ART_C ODE. The P ART_ P R OD enti ty’s compos it e P K is , P ART_C ODE + P R OD_C ODE . The use of th es e compos it e P K s means that the relationship between PART and PART_VEND is strong, asistherelationshipbetweenVENDOR and P ART_VEND . These strong relations hips are indicated throughtheuseofasolidrelations hip l ine. No P K has been indi cated for the P R OD_C UST enti ty, but the existence of weak relationships – notethe dashedrelationshiplines–letsyou assum e that the P R OD_C UST enti ty’s P K is not a compositeone.In thiscase,arevisionofthe ER D might i nclude the establis hment of a compos itePK(PROD_CODE+ CUST_NUM)forthePROD_C UST enti ty. (If you are using Microsoft Visio Professional,declaringthe relationships between C USTOMER and P R OD_C UST and between P R ODUCTandPROD_CUSTto bestrongwillautomati call y generate the compos it e P K (P R OD_C ODE + C UST_NUM .) 5. Write the con n ectivity and card in ali ty f or each of the en tities sh ow n in Qu estion 4. W e have indi cated the connec ti vit ies and cardinali ti es in Figure QB.5. (The Crow’s Foot ERDcombines theconnectivityandcardinali ty depiction through the use of the relationshipsymbols.Therefore,theuse of tex t box es – we have created those with the Visi o tex t tool -- to indi cat e connecti vit ies and cardinali ti es is technicall y redundant. )

Figu re QB.5 Con n ect ivit ies an d Cardin alit ies

514


Appendix B The University Lab: C onceptual Design

515


Appendix B The University Lab: C onceptual Design Figure QB. 5’s connecti vit ies and cardinali ti es are reflected in the business rules: One part can be suppl ied by one or more suppl iers, and a supp li er can suppl y many parts. A product i s made up of several parts, and a part can be a component of different products. A product can be bought by several custom ers, and a custom er can purchase several products. 6. Wh at is a mod u le, and w h at role does a mod u le pl ay w ith in the system? A modul e is a separate and independent coll ecti on of appli cati on programs that covers a gi ven operationalareawithinaninformation system. A modul e accomplishes a specific systemfunction,an d it is,therefore,a component of the overall system. For ex ampl e, asystemdesignedforaretailcomp any maybe compos ed of the modul es shown in Figure Q B.6.

Figu re QB.6 Th e Retail Comp an y S y stem Mod u les Re t ai l Sys t em

I nv e nto ry

Pur c h as i ng

Sa le s

Ac c o unt ing

W it hin Figure QB.6’s Retail S ystem, each modul e a ddresses specific functi ons. For ex ampl e: The inventory modul e regist ers any new it em, moni tors quanti ty on hand, reorder quanti ty, locati on, etc. The purchasing modul e regist ers the orders sent to the suppl iers, any suppl ier information, order status, etc. The sales modul e covers the sales of it ems to customers, generates the sales slips (invoices), credit sales checks, etc. The accounti ng modul e covers accounts payable, accounts receivable, and generates appropriate financial st atus reports. The ex ampl e demons trates that each modul e has a specific purpose and operates on a database subset (externalview).Eachexternalview represents the enti ti es of int erest for the specificmodule.However, anentitysetmaybe shared by several m odules. 7. Wh at is a mod u le in terf ace, an d w h at does it accomp li sh ? 516


Appendix B The University Lab: C onceptual Design A modul e int erface is the method through which modul es are connected and by which they interactwith oneanothertoexchangedataand status information. The definiti on of proper moduleinterfacesis criticalforsystems developm ent, because such interfaces establish an ordered way through which system components (modules) int erchange information. If the module interfaces are not properly defined, even a

517


Appendix B The University Lab: C onceptual Design coll ecti on of properly working modul es will not yield a u seful working system.

Prob lem S olut ions 1. Mod if y the in itial ER d iagram p resen ted in Figu re B.19 to in clu d e the f oll ow in g en tity su p ertype an d su b types: T h e Uni versity Comp u ter L ab USE R may b e a stu den t or a facu lt y m em ber . The answer to problem 1 is in cluded in the answer to problem 2. 2. Usin g an ER d iagram, il lu strate h ow the ch an ge you mad e in p rob lem 1 af f ects the relationship of the USE R en tity to th e f oll ow in g en tities: L AB_USE _L OG RES E RVATIO N CHE CK_OUT WIT HDRAW The new ER diagram segment will con tain the supertypeUSERandthesubtypesFACULTYand S TUDENT. How the use of thi s supertype/subt ype relations hips affect the enti ti es shown here is illustratedintheERdiagramshownin Figure P B. 2a.

518


Appendix B The University Lab: C onceptual Design

Figu re P B.2a Th e Crow ’ s Foot ERD w ith S u p ert y p es an d S u b t y p es

The ER segment shown in Figure P B.2a reflects t he following condit ions: Not all users are facult y members, so FACULTY is op ti onal t o USER . Not all users are students, so S TUDENT is op ti onal t o USER . The condit ions i n the first t wo bullets are typical of the supertype/subt ype im plementation. Not all facult y members withdraw it ems, so a facult y member may not ever show up in the W ITHDRAW table. Therefore, W ITHDRAW is op ti onal t o FACULTY. Not all it ems are necessaril y withdrawn; some are never us ed . Therefore W ITHDRAW is opti onal to ITEM. (An it em that is never withdrawn will never show up in the W ITHDRAW table.) Not all it ems are checked out, so an ITEM may never show up in the C HEC K_OUT table. Therefore, C HEC K_OUT is op ti onal t o ITEM. Not all u sers check out it ems, so it is possi ble that a USER – a facult y member or a student -- never shows up i n the CHECK_OUT table. Therefore, C HEC K_OUT is op ti onal t o USER . Not all facult y members place reservati ons, so R ES ERVATION is op ti onal t o FACULTY. Not al l students use the lab, i.e., some students will never sign the log to check in. Therefore, LOG is op ti onal t o S TUDENT. 519


Appendix B The University Lab: C onceptual Design Given the tex t’s ini ti al developm ent of the UCL Management S ystem’s ERD, the USER enti ty was

520


Appendix B The University Lab: C onceptual Design related to both the W ITHDRAW and C HEC K_OUT enti ti es. Therefore, there was no way of knowing whether a STUDENT or a FACULTY member was relatedtoWITHDRAWorCHECK_OUT.Although the business rules were quit e specific about t he relations hips, the ER diagram di d not reflect t hem. By adding a new USE R supertype and two S TUDENT and FACULTY subt ypes, the ERD more closely represents the busi ness rules. The supertype/subt ype relations hip in Figure P B. 2aletsusseethat STUDENTisrelatedtoLOG, and that only FACULTY members can make a R ES ERVATIONand WITHDRAWitems.However,bothS TUDENT and FACULTY can C HEC K_OUT it ems. W hil e thi s supertype/subt ype solut ion conforms to the problem solut ion requirements,thedesignisfar fromcompl ete. For ex ampl e, one would suppose that FACULTY is already a subt ype to EMP LOYEE. Also, can a facult y member also be a student? In other words, are the supertypes/subtypes overlappingor disjoint?InthisinitialERD, we have assum ed overlapping subt ypes; that is, ausercanbeafaculty memberandastudentatt he same tim e. Another solut ion -- which would eli mi nate the USER /FACULTY and USER /S TUDENT supertype/subt ypes in the ERD – is to add an att ribute, such as USER _TYP E, to the USER enti ty to identify the user as facult y or student. The appli cati on software can then be used to enforcethe restrictionsonvarioususer types. Actually, that approach was used in the final(verified) Computerlab.mdbdatabase on your CD. (The verified database is provided for Appendix C .) 3. Create the in itial ER d iagram f or a car d ealersh ip . T h e d ealersh ip sell s b oth n ew an d u sed cars, an d it op erates a service f acil ity. Bas e you r d esign on the f oll ow in g b u sin ess rul es: a. A salesp erson can sell man y cars b u t each car is s old b y on ly on e sal esp erson . b. A cu stomer can b u y man y cars b u t each car is s old t o on ly on e cu stomer. c. A salesp erson w rites a si n gle in voice f or each car sol d . d. A cu stomer gets an i n voice f or each car (s)h e b u ys. e. A cu stomer migh t come in just to h ave a car serviced ; that is, on e n eed n ot b u y a car to b e class if ied as a cu stomer. f. Wh en a c u stomer takes on e or more cars in f or rep air or service, on e service tick et is w ritten f or each car. g. T h e car d ealersh ip main tain s a service h istory f or each car service d . T h e service record s are ref eren ced b y the car's s erial n u mb er. h. A car b rou gh t in f or s ervice can b e w orked on by many mechanics, and each mechanic may w ork on man y cars. i. A car that is serviced may or may n ot n eed p arts. (For examp le, p arts are n ot n ecessary to ad just a carb u retor or to clean a f u el i n jector n ozzle.) 521


Appendix B The University Lab: C onceptual As you ex ami ne the ini t ial ERD in Figure P B.3a, note that busi ness rules (a) through (d) refer tothe Design relationshipsoffourmainentitiesin the database: S ALES P ERS ON, INVOIC E, C USTOMER,and CAR.NotealsothatanINVOICE requires a S ALES P ERS ON, a C USTOMER, and a C AR. Business rule(e)indicatesthatINVOICEis opti onal to C USTOMER and C AR because a C AR is not necessarily soldtoaCUSTOMER.(Somecustom ers only have their cars service d.) The posi ti on of the C AR enti ty and it s relations hips to the C USTOMER and INV_LINE enti ti es is subj ect to discussi on. If the dealer sell s the C AR, the C AR enti ty is clearly related to the INV_LINE that

522


Appendix B The University Lab: C onceptual Design is related to the INVOIC E. (If the car is sold, it generates one invoi ce li ne on the invoi ce. However,the invoiceislikelytocontain addit iona l invoi ce li nes, such as a dealer preparationcharge,destination charge,and so on.) At t his po int , the discussi on can proceed in di fferent di recti ons: The sold car can be li nked to the custom er through the invoi ce. Therefore, the relationship betweenCUSTOMERandCAR shown in Figures P B.3a and P B.3b is not necessary. If the custom er brings a car in for service – whether or not that car was bought at the dealer– the relationshipbetweenC USTOMER and C AR is desirable. After all , whenaserviceticketis writtenintheS ERVIC E_LOG, it would be nice to be able to li nk the custom er to the subsequent transacti on. More im portant, it is the custom er who gets the invoi ce for the service charge. However, if the C USTOMER -C AR relations hip is to be retained, it will beappropriatetomakea distinction between the cars in the dealership’s inventory – which are not related to a customerat thatpoint–andthecarsthat are owned by custom ers. If no dist inction is madebetween customer-ownedcarsandcars sti ll in the d ealership inventory, Figure P B.3a’sCARentitywill eitherhaveanullC UST_NUM or the custom er enti ty must contain adummyrecordtoindicatea “nocustomer– dealer-owned” condit ion.

Figu re P B.3a Th e Car Dealersh ip In itial Crow ’ s Foot ERD

523


Appendix B The University Lab: C onceptual R egardless of which argument Design “wins� in the presentation of the various scenarios, remi nd thestudents thattheERDtobedevelopedinthi s ex ercise is to reflect the ini ti al design. Moreimportant,such discussionsclearly indi cate the need for very detailed descript ions of operati ons and the development of

524


Appendix B The University Lab: C onceptual Design precisely writ ten busi ness rules. (It may be useful to review that busi ness rules, which are derivedfrom thedescriptionofoperations, are writ ten to help define entities, relationships, constraints, connectiviti es, and cardinali ti es.) The dealer’s service functi on is li kely to be crucial to the dealer – good service helps generatefuture salesandtheservicefuncti on is very li kely an im portant cash flow generator.Therefore,theCARentity playsan im portant r ole. If a custom er brings in a car for service and the car was not bought at the dealership, it must be added to the C AR table in order to enable the system to keep a record of the service. This is why we have depicted the C USTOMER – ow ns - C AR relationship in Figures PB.3aand PB.3b.Also,notethattheoptionali ty nex t to C AR reflects the fact that not all cars areownedbya customer:Somecarsbelongtothe dealership. Because Figure P B. 3a shows the ini ti al ERD, that ERD will be subj ect to revisi on as the descriptionof operationsbecomesmore detailed and accurate, thus modi fying some of theexistingbusinessrulesand creating addit ional busi ness rules. Therefore, addit ional enti ti es and relations hips are li kely to be developedandsomeoptionalrelationships may become mandatory, while some mandatory relationships maybecomeoptional.Additi onal changes are li kely to be generated by normalizationprocedures. Finally,theini ti al design includes some features that requirefinetuning.Forexample,a SALESP ERS ON is just another kind of EMP LOYEE – perhaps themaindifferencebetween“general” empl oyee and a sales person is that the latter requires tracking of sales performance for commission and/orbonuspurposes. Therefore, EMP LOYEE would be the supertyp e and SALESPERSONthe subtype.Alltheseissues must be addressed in the verificati on and logicaldesignphasesaddressedin Appendix E. Incidentall y, your students may ask why the design does not show a HIS TOR Y enti ty. The reasonforis absenceisthatthecar’shistory can be traced through the SER VIC E enti ty.

NOTE Althou gh w e are gen erall y relu ctant to mak e f orw ard ref eren ces, you may f in d it very u sef u l to lookaheadtotheERDshowninAppendixC’s Figu re PC.1a. T h e d iscus sion that p reced es the presentationofthemodifiedERDisesp ecial ly valu ab le – stud en ts of ten f in d su ch sampledata tobethekeytounderstandinga comp lex d esign . In an y case, the modified ERD in Figure PC.1a p rovid es amp le evid en ce that th e in itial E RD is on ly a star ti n g p oin t f or the design p rocess.

As you discuss the design shown in Figure P B. 3a, note that it is far from im plementation -ready. For ex ampl e, The INVOIC E is li kely to contain mul ti ple charges, yet it is only capable of handli ng onecharge atatimeatthispoint.Theaddit ion of an INV_LINE enti ty is clearly an ex cell ent i dea.

525


Appendix B The University Lab: C onceptual The S ERVIC E enti ty has some severe limitations caused by the lack of a Design SERVICE_LINEentity. (Notetheprevious point .) Given thi s design, it is im possi ble to store and track all the indi vid ual service (maint enance) procedures that are generated by a single service request. For ex ampl e, a 50,000 mi le check may invol ve mul ti ple procedures such as belt replacements, ti re rotation,tire balancing,brakeservice, and so on. Therefore, the SER VIC E enti ty, li ketheINVOICEentity, mustberelatedtos ervice li nes, each one of which details a specific maintenance procedure.

526


Appendix B The University Lab: C onceptual Design The P ART_USAGE enti ty’s functi on is rather li mi te d. For example, its depiction as a composite entitydoesproperlytranslate the noti on that a part can be used in many serviceproceduresanda service procedure can use many parts. Unfortunately, the lack of a SERVICE_LINE entitymeans thatwecannottracktheparts use to a particular maintenance procedure. According to busi ness r ule (d), the relations hip between C AR and INVOIC E would be 1:1. However, if it is possi ble for the dealer to t ake the car in trade at a later date and subsequently sellsitagain,thesameC AR_VIN value may appear in INVOIC E more than once.Wehave depictedthelatter scenario. The ini ti al design does have one very nice feature at thi s point : The ex ist ence of the W ORK_LOG entity’sWORKLOG_ACTIONattribute makes it possi ble to record which mechanic startedtheservice procedureandwhichone ended the proce dure. (The W ORKLOG_ACTION att ributehasonlytwo values,openandclose.) Note that thi s feature eli mi nates the need for a nullendingdateintheSERVICE entitywhile the car is being serviced. Bett er yet, if we need tobeabletotrackwhichmechanicsopened and closed the service procedure, the W ORK_LOG enti ty’s presence eli mi nates the need for synonyms intheSERVICEentity.Note,forex ampl e, that the foll owing few sampl e entries in theWORK_LOG tableletsusconcludethat service number 12345 was open ed by mechanic 104 on10Mar-2014and closedbythesamemechanic on 11 -Mar-2014.

Tab le P B.3 S amp le Dat a En t ries in t h e WORK_LOG En t ity E MP_NUM 104 107 104 104 112

SE RVICE_NUM 12345 12346 12345 12346 12347

WORKL OG_ACT ION WORKL OG_DAT E OPEN 10-Mar-2014 OPEN 10-Mar-2014 C LOS 11-Mar-2014 E C LOSE 11-Mar-2014 OPEN 11-Mar-2014

The format you see in Table P B.3 is based on a standard we developed for aviation maintenance databases.Becausealmostall aspects of aviation are ti ghtl y regulated, accountabilityisalwayscloseto thetopof the li st of design requirements. (In thi s case, we must be able to find out who opened the maintenance procedure and who closed it .) You will discover in C hapter 9, “Database Design,” thatwe willapplytheaccountabilitystand ard to other aspects of the design, too. (W ho performedeach maintenanceprocedure?Who signed out the part(s) used in each maintenance procedure? And so on.) It is w orth re pe a ting tha t a dis c us s ion of the s hortcomingsoftheinitialdesignwillset ane x c e ll e nt s tage for the i ntroduction of Appendix C’s ve rific a tion proce s s .

527


Appendix B The University Lab: C onceptual S trict accountabili tyDesign standards are becomi ng the rule in many areas outside aviation. Such standardsmay betriggeredbylegislationor by company operati ons i n an increasingly li ti gious environment.

528


Appendix B The University Lab: C onceptual Design 4. Create the in itial ER d iagram f or a vid eo ren tal sh op . Use (at least) th e f oll ow in g d escrip tion of op eration s on w h ich to base you r b u sin ess rul es . Th e vid eo ren tal sh op class if ies movie titles accord in g to their type: Comed y, Western , Classical, ScienceFiction,Cartoon,Action , Mu sical, an d New Release. E ach type con tain s manypossible titles,andmosttitleswithina type are available in multiple copies. For example,notethesummary presentedinTable PB.4:

Tab le P B.4 Th e Video R en t al Ty p e an d Title Relat ionsh ip T YPE Mu sical

Cartoon

Action

T IT L My Fair Lad yE My Fair Lad y Ok lah oma! Ok lah oma! Ok lah oma! Dill y Dally & Ch it Ch at Cat Dill y Dally & Ch it Ch at Cat Dill y Dally & Ch it Ch at CatJou rn ey Amazon Amazon Jo u rn ey

COPY 1 2 1 2 3 1 2 3 1 2

Keep the f oll ow in g con d ition s in min d as you d esign the vid eo ren tal d atabase: T h e movie typ e class if ication is s tand ard ; not all typ es are n ecessarily i n stock . T h e movie lis t is u p d ated as n ecessary; h ow ever, a movie on that li st m igh t n ot b e ord ered if thevideoshopownerdecidesthatitthe movie is n ot desirab le f or some reason . T h e vid eo ren tal sh op d oes n ot n ecessarily ord ermoviesfromallofthevendorlist;some ven d ors on the ven d or li st are merely p oten tial vendorsfromwhommoviesmaybeorderedin the f u ture. Movies class if ied as n ew releases are reclass if ied to an appropriate type after they have beenin stockformorethan30days.Thevideo sh op man ager w an ts to h ave an en d -of - p eriod (w eek, month,year)reportforthenumberofren tals b y type. If a cu stomer req u ests a title, the clerk mu st b e ab le to f in d it q u ickl y. Wh en a customer selects oneormoretitles,aninvoiceisw ritten . E ach in voice may thus contain charges foroneormore titles.Allcustomerspayin cash . Wh en th e cu stomer ch eck s ou t a title, a record is k ep t of the ch eck ou t d ate an d time an d the exp ected return d ate an d time. Upon the return of ren ted titles, the clerk must be able to check quicklywhetherthereturnislateand to assess th e ap p rop riate lat e retu rn f ee. T h e vid eo -store ow n er w an ts to b e ab le to gen erate p eriod ic reven u e rep orts b y title an d b y type. T h e ow n er also w an ts to b e ab le to gen erate p eriod ic in ven tory rep orts and to keep track of titles on ord er. 529


Appendix B The University Lab: C onceptual T h e vid eo -storeDesign ow n er, w h o emp loys tw o ( salaried ) f u ll -time an d three (hou rly) p art -time employees,wantstokeeptrackofall emp loyee w ork time an d p ayroll d ata. Part time employeesmustarrangeentriesinaw ork sch ed u le, w h il e all emp loyees sign in an d ou t on a w ork log.

530


Appendix B The University Lab: C onceptual Design

NOTE T h e d escrip ti on of op eration s n ot on ly establ ish es the op eration al asp ects of the business; it also establ ish es some sp ecif ic system ob jectives w e h ave li sted n ext.

As you design thi s database, remember that transacti on and information requirements helpdrivethe designbydefiningrequired enti ti es, relations hips, and att ributes. Also, keep in mind that the description provided by the problem leaves many possi bil it ies for design differences. For ex ampl e, consi derthe EMPLOYEEclassificationasfull-time or part -time. If there are few dist inguishi ng characteristics betweenthetwo,thesituati on may be handled by using an att ribute EMP _C LASS(whosevaluesmight beForP)intheEMP LOYEE table. If full -ti me empl oyees earn a base salaryandpart-timeemployees earnonlyan hourly wage, that problem can be handled by havingtwoattributes,EMP_HOURPAYand EMP _BASE_P AY, in EMP LOYEE. Using thi s approach, theHOUR_PAYwouldbe$0.00forthe salaried full -ti me empl oyees, while the EMP _BASE_P AY would be $0.00 for the part -time employees. (To ensure correct pay comput ati ons, the appli cati on software would select eit her F or P , dependingon theemployeeclassification.) On the other hand, if part -ti me empl oyees are handledquitedifferently fromfull-time empl oyees in terms of w ork scheduli ng, benefits, and so on, it would be bett er to use a supertype/subt ype classificati on for FULL_TIME and P ART_TIME empl oyees. (The more unique variablesexist,themoresensea supertype/subt ype relations hip m akes.) For discussi on purposes, ex a mi ne the foll owing requirements: The clerk mus t be able to find customer's requests quickly. This requirement is met by creati ng an easy way to query the MOVIE data (by name, type, etc.) while entering the RENTAL data. The clerk must be able to check quic kly whether or not the return is late and to assessthe appropriate“latereturn�fee. This requirement is met by adding attributessuchasexpectedreturn date, actual return date, and late fees to the R ENTAL enti ty. Note that there is no need to adda newentity,nordoweneedtocreatean addit ional relations hip. Keep in mi nd that some requirementsareeasilymetby including the appropriate attributes in thetablesandbycombining thoseatt ributes through an appli cati on program that enforces the busi n ess rule. R em em ber that notallbusinessrulescanberepresen ted in th e databas e con ceptu al diagr am . The (store owner) wants t o be able to keep track of all empl oyee work ti me and payroll data. Here we must create two new entities: WORK_SCHEDULE and WORK_LOG, which will show the empl oyee's work schedule and the actual ti mes worked, respecti vely. These enti ti eswillalso helpusgeneratethepayroll report. The descriptio n also s pecifies som e of the ex pected reports: 531


Appendix B The University Lab: C onceptual End-of-period Design report for the number of rentals by type. This report will use the R ENTAL, MOVIE,andTYPEentitiesto generate all rental data for some specified period of ti me. R evenue report by ti tl e and by type. This report will use the R ENTAL, MOVIE, and TYP E enti ti es to generate all the ren tal data. P eriodic inventory reports. This report wil l use the MOVIE and TYP E enti ti es. Titl es on order. This report wil l use the ORDER, MOVIE, and TYP E enti ti es. Empl oyee work ti mes and payroll data. This report will use the EMP LOYEE,

532


Appendix B The University Lab: C onceptual Design W ORK_SC HEDULE, and W ORK_LOG enti ti es. This summ ary sets the stage for the ERD shown in FigurePB.4a.NotethattheWORK_SCHEDULE and W ORK_LOG enti ti es are opti onal to EMP LOYEE. The opti onali ti es reflect the following condit ions: Only part-ti me empl oyees have correspondi ng re cords in the work log table. Only full -ti me empl oyees have correspondi ng records in the work schedule table. Although there is a temptation to create FULL_TIME and P ART_TIME enti ti es, which are thenrelated toWORK_LOGandWORK_SCHEDULE, respecti vely, suc h a decisi on reflects a subst itutionofan entityforanattribute.Itisfar bett er to sim ply create an att ribute, perhaps namedEMP_TYPE,inthe EMPLOYEEentity.The EMP _TYP E att ribute values would then be P = part -timeorF=full-time.The applications software can then be used to force an entry into theWORK_LOGandWORK_SCHEDULE entities, depending on the EMP _TYP E att ribute value. S tud en t q u estion : Usin g the argu men t just p resen ted , w h at other en tity migh t b e rep laced b yan attribute?Answer:TheTYPEentitycanbe representedbyaTITLE_TYPEattributeinthe T IT L E en tity. T h e T IT L E _T YPE valu es w ou ld then b e“Western”,“Adventure”,andsoon.This app roach w ork s f in e, as lon g as the type valu es d on ’t req u ire ad d ition al d escrip tive material . In thelattercase,theTYPEwouldbebetterrep resentedbyanentityinordertoavoiddata red u n d an cy p rob lems.

Figu re P B.4a Th e In itial Crow ’ s Foot ERD f or t h e Video Ren t al St ore

533


Appendix B The University Lab: C onceptual Design

534


Appendix B The University Lab: C onceptual Design Additi onal discussi on: At thi s point , the ERD has not yet been verified against the transacti on requirements.Forexample,thereisnoway to check which specific video has been rented by acustomer. (Iffivecustomersrentcopiesof the same video, you don’t know which custom er haswhichcopy.) Therefore,thedesign requires addit io nal work triggered by the verificati on process . In addit ion, the work log enti ty’s LOG_DATE is incapable of tracking when the part -ti me empl oyees loggedinorout.Therefore,twodates must be used, perhaps named LOG_DATE_IN and LOG_DATE_OUT. In addit ion, if you want to determi ne the hours worked by each part-time employee, itwillbenecessarytorecordtheti me in and ti me out. S im il arly, the work schedule cannot yet be used to t rack the full -ti me empl oyees’ schedules. W ho has worked and when? C learly, the verificati on process di scussed in Appendix C is not a lux ury! 5. S u p p ose a man u f acturer p rod u ces three h igh -cost, low -volu me p rod u cts: P1, P2, and P3. Product P1isassembledwithcomponentsC1and C2; p rod u ct P2 is assemb led w ith comp on en ts C1, C3, andC4;andproductP3isassembledwith components C2 and C3. Components may be purchased fromseveralvendors,asshowninT ab le PB.5:

Tab le P B.5 Th e Comp on en t /Ven d or S u mmary VENDOR V1 V2 V3

COMPONE NTS S UPPL IE D C 1, C 2 C 1, C 2, C 3, C 4 C 1, C 2, C 4

E ach p ro d u ct h as a u n iq u e serial n u mb er, as d oes eachcomponent.Tokeeptrackofproduct perf orman ce, caref u l record s are k ep t to en su re that each p rod u ct's comp on en ts can b e traced to the comp on en t sup p li er. Prod u cts are sold d irectly to f in al cu stomers; that i s, n o w h olesale op eration s are p ermitte d .The salesrecordsincludethecustomeriden tif ication an d the produ ct serial n u mb er. Usin g the preced in g in f ormation , d o the f oll ow in g: a. Write the bu sin ess rul es govern in g the produ ction an d sal e of the produ cts. The busi ness rules are sum mariz ed in Figure P B. 5A.

535


Appendix B The University Lab: C onceptual Design

Figu re P B.5A Th e Bu sin ess Ru le S u mmary P RO DU CT CO M P O NEN TS P1 P2 P3

C1 C1

Bus i ne s s R u le

C2

1 . A c om pone nt c an be p a rt of s e ve r al p r oduc t s , and a p r oduc t i s m ade u p of se ve r al c omp one nt s .

C3 C4 C2 C3

VEND O R CO M P O NEN TS SUP P L IED

Bus i ne s s R u le 2 . A c om pone nt c an be su pplie d b y se ve r al ve nd o rs, an d a ve n do r supp lie s se ve r al c omp one nt s.

V1 C1 C2 V2 C1 C2 C3 C4 V3 C1 C2 C3

b. Create an ER d iagram cap ab le of su p p ortin g the man u f acturer's p rod u ct/comp on en t track in g req u iremen ts. The two busi ness rules shown in Figure P B. 5A all ow the designer to generate the ERD Shown in FigurePB.5B1.(NotetheM:Nrelations hips between P R ODUCT and C OMPONENT and between C OMPONENT and VENDOR that have been converted through the composite entities P R OD_C OMP and COMP _VEN B. )

Figu re P B.5B1 Th e In itial Crow ’ s Foot ERD f or Prob lem B. 5B

As you ex ami ne Figure P D5.B1, note that we have use default opti onali ti es in the composite entitiesnamedPROD_COMPand COMP_VENB. Naturally, these optionalities mustbeverified againstthebusiness rules before the design is im plemente d. However,atthispointthe 523


optionalities make sense – after all , various version of a P RODUCTdonotnecessarilycontain all avail able C OMPONENTs, not do all VENDORs suppl y all C OMPONENTs. Quite aside

524


Appendix B The University Lab: C onceptual Design from the li kely ex ist ence of the relations hips we just point ed out, opti onali ti es are generally desirablefromanoperational point of view – at least from the database managementangle.Yet, nomatterhow “obvious ” a relations hip may appear to be, itisworthrepeatingthattheexistence of the opti onali ti es must be verifie d. Designs that do not reflect the actual data environmentare notlikelytobeusefulatt he end user level. Given the ERDs in Figures P B. 5B1 and P B.B2, you can see that each P R ODUCT entry actu ally represen ts a produ ct li n e, i.e., a coll ecti on of produ cts belon gin g to th e sam e produ ct typeor line,ratherthanaspecificprodu ct occu rrence w it h a u n iqu e serial n u m ber . Therefore,this modelwillnotenableusto identify the serial number for each provider of a part that was used product in a specific occurrence. the example in ion componentusedin,forexample,a with PRODUCT serial number 348765. (Note Therefore, thi s solut Figur does not all ow us to track the P B. 5C .) e

Figu re P B.5C A n In itial I mp lemen t at ion PRODU CT

P1 P2 P3

PROD_C OM P

P1 P1 P2 P2 P2 P3 P3

C1 C2 C1 C3 C4 C2 C3

COMPON EN T

C1 C2 C3 C4

COMP_ VEN D

C 1 C 1 C 1 C C 22 C2 C3 C4 C4

V1 V2 V3 V1 V2 V3 V2 V2 V3

V EN D O R

V1 V2 V3

As you ex ami ne Figure P B.5C , n ote that there are no serial numbers for the components, norare thereanyfortheproducts produced. In other words, we do not meet the requirements im posed by: B USINE S S RUL E 3 Each product has a unique serial number. For ex ampl e, there will be several products P 1, each withauniqueserialnumber.Each unique product will be compos ed of several components,and eachofthosecomponents has a unique serial num ber. The im plementat ion of busi ness rule 3 will all ow us to keep track of the suppl ier of each component.

525


Appendix B The University Lab: C onceptual One way to produce Designthe tracking capabil it y required by busi ness rule 3 is to use a ternary relationshipbetweenPRODUCT,C OMPONENT, and VENDOR, shown in Figure P 5.5D 1:

526


Appendix B The University Lab: C onceptual Design

Figu re P B.5D1 Th e Crow ’ s Foot Tern ary Relat ionsh ip b et w een PR ODUC T, COMPONENT, an d VEND OR

The ER diagram we have just shown represents a many-to-many-to-many TERNAR Y relations hip, ex pressed by M:N: P . This t ernary relations hip i ndicates that: A product is compos ed of many components and a component appears in many products. A component is provided by many vendors and a vendor provides many products. A product contains components of many vendors and a vendor's components appear in many products. Assigni ng att ributes to the S ERIALS enti ty, we may draw the dependency diagram shown in Figure P 7 -5E.

527


Appendix B The University Lab: C onceptual Design

Figu re P7 - 5E Th e In itial Depend en cy Diagram

P _ SER IAL

C_ SER IAL P RO D_ TYP E CO M P _ TYP E VEND _ CO DE

pa rt ial de pe nde nc y

t ran sit ive de pe nde nc ie s

W e may safely assum e that all serial numbers are unique. If we make thi s assum pti on , we can concludethattheproductserial number will identify the product type and thatthecomponent serialnumberwill identify the component type and the vendor. Using the standard normalization procedures, we may thus decompos e the enti ty as shown in the dependency diagrams in Figure P B. 5F.

Figu re P B.5F Th e Normalized S t ru ct u re

The O r ig i na l D e pe nde nc y D iag r a m

P _ SER IAL

C_ SER IAL P RO D_ TYP E CO M P _ TYP E VEND _ CO DE

pa rt ial de pe nde nc y

t ran sit ive de pe nde nc ie s

The N o r m al ize d D e pe nde nc y D iag r ams Table na me : P _ SER IAL

P _ SER IAL P RO D_ TYP E

C_ SER IAL

CO M P _ TYP VEND _ CO E DE

P _ SER IAL

C_ SER IAL

Table na me : C_ SER IAL

Table na me : SER IAL

526


As you ex ami ne the dependency diagrams i n Figure P B. 5F, note the following:

527


Appendix B The University Lab: C onceptual Design P _S ERIAL has a 1:M relations hip with P R ODUCT, because one product ha s many product serial numbers. C _S ERIAL has a 1:M relations hip with C OMPONENT, because one component has many component serial num bers. S ERIAL is the compos it e entity that connects P_SERIAL and C_SERIAL, thus reflecting thefactthatoneproduct has many components and a component can be found in many products. To il lust rate the relations hips we have just described, let's take a look at some data in Figure P75G: Figu re P B.5G Samp le Dat a

P _ SER IAL P RO D_ TYP E

C_ SER IAL CO M P _ TYP E VEND O R

X0 D1 0 1 P 1 X0 C1 0 2 P 1 2 0 02 01 P 2 2 0 02 02 P 2 2 0 02 03 P 2 2 0 02 04 P 2 3 0 03 01 P 3 3 0 03 02 P 3

C9 0 00 1 C1 V1 C9 0 00 2 C1 V2 C9 0 00 3 C1 V3 C8 0 00 3 C2 V1 C8 0 00 2 C2 V1 C8 0 90 9 C2 V2 C8 0 97 6 C2 V3 C8 0 90 8 C2 V2 C8 0 96 5 C3 V2 C7 6 89 4 C3 V2 C4 0 09 7 C4 V2 C4 5 09 6 C4 V2 C6 7 67 3 C4 V3 C4 5 67 9 C4 V3

P _ SER IAL C_ SE R IAL X0 D1 0 1 C9 0 0 0 1 X0 C1 0 1 C8 0 9 7 6 X0 C1 0 2 C9 0 0 0 2 X0 C1 0 2 C8 0 0 0 2 2 0 02 01 C9 0 0 02 2 0 02 01 C7 6 8 94 2 0 02 01 C4 5 6 78 …….. … .. e t c . e t c .

The new ER diagram will enable us to identify the product by a unique serial number, and each oftheproduct'scomponentswillhave a unique serial number, too. Therefore, the newER diagramwilllooklikeFigurePB. 5H1.

528


Appendix B The University Lab: C onceptual Design

Figu re P B.5H1 Th e Revised ( Fin al) C row ’ s Foot ERD

As you ex ami ne Figure P B. 5H1’s ERD, note that the C OMP_VEND compos it e enti ty seems redundant, because the C S ERIAL enti ty already depicts the many-to-many relationshipbetween VENDORandC OMPONENT. However, C OMP_VEND represents a moregeneralrelationship thatenablesus to determi ne who the li kely providers of the generalcomponentare(whatvendors suppl y component C 1? ), rather than letti ng us determi ne a specific component's vendor (which vendorsuppliedthecomponentC1 with a serial number C 90003? ). The designer mustconfer withtheendusertodecide whether such a general relations hip is necessaryorifitcanbe removedfromthe database w it h ou t affecti n g it s sem an ti c con tent s .

529


Appendix B The University Lab: C onceptual Design 6. Create an ER d iagram f or a h ard w are store. Mak e surethatyoucover(atleast)store tran saction s, in ven tory, an d p erson n el. B ase you r ERdiagramonanappropriatesetofbusiness ru les that you d evelop . (Note: It w ou ld b e u sef u l to visi t a h ard w are store an d con d u ct in terview s todiscoverthetypeandextentofthestore's op eration s.) S in ce the problem does not specify a set of busi ness rules, we will create some that will enable us to develop an init ial ER diagram.

NOTE Please take in to con sid eration that, d ep en d in g on the assu mp tion s mad e an d on the selectionof businessrules,studentsareli k ely to create q u ite d if f eren t solu tion s to th isproblem.Youmay finditquiteusefulto stud y each stud en t solution and to incorporate themostinterestingpartsof eachsolutionin to a common E R d iagram. We k n ow that this is n ot aneasyjob,butyour studentswillbenefitb ecau se you w il l thu s en ab le them to d evelop veryimportantanalytical skills.Youshou ld stress th at: A probl em may b e examin ed f rom man y d if f eren t angl es. S imil ar organ ization s, u sin g d if f eren t b u sin ess ru les, w il l gen erate d e sign p rob lems that may b e sol ved throu gh the use of q u ite d if f eren t solu tion s.

To get t he class dis cussi on st arted, we will assum e these busi ness rules: 1. A product i s provided by many suppl iers, and a suppl ier can provide several products. 2. An empl oyee has many dependents, b ut a dependent can be claimed by only one empl oyee. 3. An empl oyee can writ e many invoi ces, but each invoi ce is writt en by only one empl oyee. 4. Each invoi ce belongs to o nly one custom er, and each custom er owns m any invoi ces. 5. A custom er makes several payments, and each payment belongs to o nly one custom er. 6. Each payment may be appli ed partiall y or tot all y to one or more invoi ces, and each invoi ce can be paid off in one or more payments. Using these busi ness rules, we may generate the ERD shown in Figure P B. 6A.

530


Appendix B The University Lab: C onceptual Design

Figu re P B.6A Th e Crow ’ s Foot ERD f or Prob lem 6 ( Th e Hard w are S t ore)

531


Appendix B The University Lab: C onceptual Design Th e ERD shown in Figure P B. 6A requires less tweaking than the previous ERDs to get it ready for implementation.Forexample,giventhe presence of the INV_LINE enti t y, the custom er canbuymore thanoneproductperinvoice.Sim il arly, the ORD_LINE enti ty makes it possi ble formorethanone producttobeorderedper order. However, as you ex ami ne the P AYMENT enti ty in Figure P B. 6A, note that the current P K definiti on limitsthepaymentsforagivencustomerand invoi ce number to one per day. (Two payments by thesame customerforthesameinvoicenumber on the same date would viol ate the enti ty int egrityrules,because thetwocompositePK values would be identical in that scenario.) Therefore,thedesignshowninFigure PB.6A sti ll requires addit ional work, to be compl eted during the verificati on process . 7. Use the f oll ow in g b rief d escrip tion of op eration s as th e sou rce f or the next d atabase design: AllaircraftownedbyROBCORrequirep eriod ic main ten an ce. Wh en main ten an ce is req u ired, a main ten an ce log f orm is u sed to en ter the aircraf t id en tif ication n u mb er, the general nature of the main ten an ce, an d the main ten an ce startin g d ate. A samp le main ten an ce log f orm is sh ow n in Figu re PB.7A.

FIGURE PB.7A Th e Maint en an ce Log Form

532


Appendix B The University Lab: C onceptual Design

533


Appendix B The University Lab: C onceptual Design Note that the main ten an ce log f orm sh ow n in Figu rePB.7Acontainsaspaceusedtoenterthe main ten an ce comp letion d ate an d a sign ature sp ace f or the supervising mechanic who releases the aircraf t b ack in to service. E ach main ten an ce logformisnumberedsequentially.Note:A sup ervisi n g mech an ic is on e w h o h old s a sp ecial Fed eralAviationAdministration(FAA) Insp ection Auth orization (IA). Th ree of ROB COR’s ten mech an ics hol d su ch an IA. On ce th e main ten an ce log f orm is in itiated , the maintenancelogform’snumberiswrittenona m ain tenan ce specificati on sh eet , also k n ow n as a m ain tenan ce li n e form . Wh en comp leted , the sp ecif ication sh eet con tain s the d etails of each main ten an ce action , the time req u ired to complete themaintenance,parts(ifany)used in the main ten an ce action , an d the id en tif icationofthe mechanicwhoperformedthemain ten an ce action . T h e main ten an ce sp ecif icationsheetisthe billingsource(timeandp arts f or each of the mai n ten an ce action s), an d itisoneofthesources throughwhichpartsuse may b e au d ited . A samp le main ten an ce sp ecif icationsheet(lineform)is showninFigure PB.7B .

FIGURE PB.7B Th e Maint en an ce Line Form pag e 1 of 1

Log #: 21 55 Ite m 1 2 3 4 5 6

Ac tio n d es cr i ptio n P erf or m ed r un up . R oug h m ag rCes et ed #2 b ott om p l ean lu g, l ef t eng in e R epl ac ed n os e g ear s him m y d am p en R eplerac ed l ef t m ai n g ear d oor ol eo s tr ut s eal C l ean ed an d c h ec k ed g ear s tr ut s eals

T ime

Par t

Un its

M echani c

0.8 N on e

0

112

0.9 N on e

0

112

1.3 P- 21 33 42A

1

103

1.7 G R /31 11 09S

1

112

1.7 N on e

0

116

7 8

Parts u sed in an y main ten an ce action mu st b e sign ed ou t b y the mech an ic w h o u sed them, thu s all ow in g ROB COR to track its p arts in ven tory. E ach sign -ou t f orm con tain s 534


Appendix B The University Lab: C onceptual a li stin g of all the p arts associated w ith a given main ten an ce log en try. T h eref ore, a p arts Design sign -out form containsthe maintenancelognumberagainstw h ich the p arts are ch arge d . In ad d ition , the p artssign-out procedureisusedtoupdatethe ROB COR p arts in ven tory. A sample parts sign -out form is shown

535


Appendix B The University Lab: C onceptual Design in Figu re PB. 7C.

FIGURE PB.7C Th e Part s S ign - ou t Form pag e 1 of 1 Log #: 21 55 For m s equ en ce #: 2 422 6 Par t

De scr ipt ion

Un its

P - 21 33 42A

N os e g ear s hi m m y d am p en er , PA31- 35 0/ 19 73

1

G R /31 11 09S

L ef t m ain g ear d oor ol eo s tr ut s eal, PA3 1- 35 0/1 97 3

1

Un it Pr ic e $18 9. 45 $59 .7 6

M echani c 112 103

Mech an ics are h igh ly sp ecial ized ROB COR employees, and their qualifications are quite different f rom those of an accou n tant or a secretary, f or examp le . Given this b rief d escrip tion of op eration s, d raw the f u ll y lab eled E R d iagram. Mak e su re you in clu d e all the ap p rop riate relation sh ip s, con n ectivities, an d card in ali ties. Before drawing the ER diagram, not e the foll owing relations hips: Not all empl oyees are mechanics, but all mechanics are empl oyees. Therefore, the MECHANIC enti ty is op ti onal t o EMP LOYEE. The EMP LOYEE is t he supertype to MEC HANIC . All mechanics must sign off work on the MAINTENANC E they performed and they must sign out for the PAR T(s) used. Only some mechanics (the IAs) may sign off the LOG. Therefore, LOG is opti onal to MEC HANIC . Because not all MAINTENANC E entries are associated with a P ART --- some maintenance doesn't require parts --- P ART is opti onal t o MAINTENANC E. These relations hips are all reflected in the ER diagrams s hown in Figure P B. 7. 536


Appendix B The University Lab: C onceptual Design

Figu re P B.7D1 Th e In itial Crow ’ s Foot ERD f or Prob lem 7 ( ROBCOR A ircraf t S ervice)

537


Appendix B The University Lab: C onceptual Design As you discuss the ERD shown in Figure P B. 7D1, note it s sim il arity to the car dealership’s maintenance sectionoftheERDpresentedin Figure P B.3a. However, the R OBC OR Aircraft S erviceERDhasbeen developedatamuchhigher detail level, thus requiring fewer modi ficati onsduringtheverification process.FigureP B. 7D1 shows that: Each LOG enti ty occurrence will yield one or more maintenance procedures. Each of the indi vidual mai ntenance procedures will be li sted in t he LOG_LINE enti ty. A mechanic must sign off on each of the LOG_LINE enti ty occurrences. The possi ble parts use in each LOG_LINE enti ty occurrence is no w traceable. A part can be accounted for from the mom ent it is si gned out by the mechanic to the point at which it is i nstalled during the maint enance procedure. The “references” relations hip between LOG and PART is subject to discussion. After all, you can always traceeachpart’susetotheLOGthrough the LOG_LINE enti ty. Therefore, the relationshipisredundant. Such redundancies are – or should be – picked up during the verificati on process. W e have shown the MEC HANIC to be a subt ype of the EMP LOYEE supertype. W hether the supertype/subt ype relations hip makes sens e depends on the type and extent of the attributes thataretobe associatedwiththeMECHANIC enti ty. There may be ex ternall y im posed requirements– oftenimposed throughthe government’s regulatory process -- that can best be met through a supertype/subt ype relations hip. However, in the absence of such ex ternall y im posed requirements, it is usuallybettertouse anattributeinEMPLOYEE – such as the empl oyee’s primary job code – and li nktheemployeestotheir variousqualificati ons through a compos it e e nti ty. The appli cati onssoftwarewillthenbeusedtoenforce the requirement that the person doing maintenance work is, i n fact, a mechanic. 8. You h ave just b een emp loyed b y the ROB COR T ru ckingCompanytodevelopadatabase.Togain a sen se of the d atabas e’s in ten d ed f u n ction s, you h ave sp en t some time talk in g to ROB COR’s emp loyees an d you ’ve examin ed some of the f orms u sed to track d river assi gn men ts an d tru ck main ten an ce. Your notes in clu d e the f oll ow in g ob servation s: S ome d rivers are q u ali f ied to d rive more than one type of truck operated b y ROB COR. A d river may, theref ore, b eassignedtodrivemorethanone tru ck type d u rin g some period of time. ROBCORoperatesseveraltrucksof a given type. For examp le, ROB COR op erates tw o p an el tru ck s, f ou r h alf - ton p ick -u p tru ck s, tw o sin gle -axle d u mp tru ck s, on e d ou b le -axle tru ck , an d on e 16 -w h eel tru ck . A d river w ith a ch au f f eu r’s li cen se is q u ali f ied to driveonlyapaneltruckandahalf -ton p ick -u p tru ck an d , thu s, may b e assi gn ed to d rive an y on e of six tru ck s . A d river w ith a commercial li cen se w ith an ap p rop riate h eavy eq u ip men t endorsementmaybeassignedto d rive an y of the n in e tru ck s in the ROB 538


Appendix B The University Lab: C onceptual CORfleet.Eachtimeadriveris assi gn ed to d rive a tru ck , an en try is mad Design e in a log con tain in g the employee numb er, the tru ck id en tif ication , an d the sign -ou t (dep arture) d ate. Upon thedriver’sreturn,thelogis u p d ated to in clu d e the sign -in (return)date andthenumberofd river d u ty hou rs. If tru ck s req u ire main ten an ce, a main ten an ce log is f il led ou t. T h e mai n ten an ce log in clu d es the d ate on w h ich the tru ck w as received b y the main ten an ce crew . T h e tru ck can n ot b e released f or service u n til the

539


Appendix B The University Lab: C onceptual Design main ten an ce log release d ate h as b een en tered an d the log h as b een sign ed of f b y an in sp ector. All in sp ectors are q u ali f ied mech anics,butnotallmechanicsare qu ali f ied i n sp ectors. On ce the main ten an ce log en try h as b eenmade,themaintenancelog numb er is tran sf erred to a service log in w h ich all service log tran saction s are en tered . A sin gle main ten an ce log en try c an give rise to multiple service logentries.Forexample,a tru ck migh t n eed an oil ch an ge as w ell asafuel injectorreplacement,a brake ad justmen t, and a f en d er rep air. E ach service log en try is sign ed of f bythemechanicwhoperformedthe w ork . T o track the main ten an ce costs f or each tru ck , the service log entries includethepartsusedand the time sp en t to in stall the p art or toperform theservice.(Notall service tran saction s in volve p arts.Forexample, adjustinga throttle li n k age d oes n ot req u i re the use of a p art.) All emp loyees are au tomaticall y covered b y a stand ard h ealth insurance policy.However,ROB COR’s b en ef its in clu d e op tion al co paidtermlife insuranceanddisab il ity in su ran ce. Employees may selectbothoptions,one option,or n o op t ion s . Given th ose b rief n otes, create the E R diagram. Make sure you include all appropriate entities and relationships,anddefineallconn ectivities an d card in ali ties. The ERD in Figure P B.8a contains a maintenance portion that has become our standard, given thatit enablestheendusertotrackallacti vit ies and parts for all vehicles. In fact, givenitsabilitytosupport high accountabili ty standards, we first developed the "basics" of thi s design for aviation maintenance tracking.

540


Appendix B The University Lab: C onceptual Design

Figu re P B.8a Th e In itial Crow ’ s Foot ERD f or t h e ROBCOR Tru cking S ervice

541


Appendix B The University Lab: C onceptual Design As you ex ami ne the ERD in Figure P B. 8a, note that the driver assi gnment to drive trucks is a M:N relations hip: Given the passage of ti me, a driver can be assi gned to drive a truck many ti mesandatruck canbeassignedtoadrivermany ti mes. W e have im plemented thi s relations hip throughtheuseofa compositeentitynamedASS IGN. The M:N relations hip between EMPLOYEE and BENEFIT – that is, the insurance package mentionedin problem8’slastbullet--has been im plemented through the compos it e enti ty namedEMP_BEN.(An employeecanselectmany benefit packages and each insurance package maybeselectedbymany employees.)Thereason for the opti onali ty is based on the fact that not alloftheinsurancepackagesare necessarily selected by the empl oyee. For ex ampl e, using theBENEFITtablecontentsshowninTable PB. 8A, an empl oyee may decide to select opti on 2 or opti ons 2 and 3, or neit her opti on. (The standard healthinsurancepackageisassign ed autom ati call y.)

Tab le P B.8A Tab le n ame: BENEFIT BEN_CODE 1 2 3

BEN_DES CRIPT ION S tandard healt h Co -paid t erm life insurance, $100,000 Co -paid di sabil it y insurance

BEN_CHARGE $0.00 $35.00 $42.50

Incidentall y, we have used a BENEFIT enti ty, rather t han an INSUR ANC E enti ty to anti cipate the likelihoodthatbenefitsmayincludeit ems other than insurance. For ex ampl e, employeesmightbegiven abenefitsuchasan investm ent pl an, a flex ti me option, chil d care, and so on. The decompos it ion of M:N relat ionsh ips conti nues to be a good subj ect for discussi on. For example,we haveshownmanyofthedecomposit ions as compos it e enti ti es. However, while suchanapproachis perfectlyacceptableat the ini ti al design stage, cauti on your students that compos it e P Ks cannot be referenced easil y by subsequent addit ions of enti ti es that must reference those PKs. Therefore,wewould notethatthecompositePK used in the LOG_ACTION enti ty -- EMP _ID + LOG_NUM+ LOGACT_TYPE–shouldbereplacedby an “artificial” single -att ribute P K named LOGACT_NUM. TheEMP_IDandLOG_NUMatt ributes would continue to be used as FKs to the MECHANICandLOG entities.(Naturally,the EMP _ID and LOG_NUM att ributes shoul d be index edtoavoidduplicationof recordsandtospeed up queries.) A few sampl e entries are shown in Table

Tab le P B.8B Tab le n ame: LOG_AC TION L OGACT _NUM 1000 1001 1002 1003

L OG_NUM 5023 5024 5023 5025

E MP_ID 409 409 411 378 542

L OGACT _T YPE Open Open C lose Open

L OGACT _DAT E 14-May-2014 15-May-2014 15-May-2014 15-May-2014


1004 1005

Appendix B The University Lab: C onceptual 5024 411 C lose Design 5026 409 Open

543

15-May-2014 16-May-2014


Appendix B The University Lab: C onceptual Design Finally, we have used supertype/subt ype relations hips between EMP LOYEE and DRIVER and MEC HANIC . If drivers and mechanics are assum ed to have many characterist ics (such as special certificati ons at di fferent l evels) that are not common t o EMP LOYEE, this approach eli mi natesnulls. However,keepinmindthe discussi on about the use of supertypes/s ubtypesinProblemB.(Theuseof the supertype/subt ype approach may be dictated by ex ternal factors ‌ but the use of supertypes and subt ypes must be approached with some cauti on. For ex ampl e, if drivers have mul ti ple li cense types,it wouldbefarbettertocreateaLICENS E enti ty and relate it to DRIVER through a compos iteentity, perhapsnamedDRIVER_LICENSE. The compos it e enti ty may then be designed to includethedateon whichthelicensewas earned and other pertinent facts pertaini ng to licenses.(Suchflexibilityisnot available in a subt ype, unless you are will ing to tol erate the possi ble occurr ence of null s as more pertinent data about the (mult ipl e) li censes are kept – if some of the drivers do not have all of those li censes.)

Solutions Manual for Database Systems Design Implementation and Management 12th Edition by Coronel Full clear download (no error formatting) at : https://downloadlink.org/p/solutions-manual-for-database-systems-designimplementation-and-management-12th-edition-by-coronel/ Test Bank for Database Systems Design Implementation and Management 12th Edition by Coronel Full clear download (no error formatting) at : https://downloadlink.org/p/test-bank-for-database-systems-designimplementation-and-management-12th-edition-by-coronel/ database systems design implementation & management 12th edition pdf database systems: design, implementation, & management 12th edition download database systems design implementation & management 12th edition solutions database systems design implementation and management 12th edition answers database systems design implementation and management 11th edition pdf database systems design implementation and management 11th edition pdf free download database systems design implementation and management 12th edition answer key database systems design implementation & management 13th edition

544


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.