database answers to review questions

Upload: amirah-husna-abu

Post on 02-Mar-2018

234 views

Category:

Documents


1 download

TRANSCRIPT

  • 7/26/2019 DATABASE Answers to Review Questions

    1/46

    Answers to Review Questions

    1. Name and discuss the different levels of data abstraction as defined byANSI/SPARC.

    Conceptual

    Located at the abstraction apex, the conceptual model represents a global view of thedata. It forms the basis of the conceptual schema, which provides a relatively easilyunderstood bird's-eye view of the data environment. Since the conceptual model focuseson the main data objects and avoids detail, it exhibits both software and hardwareindependence. he most widely used conceptual model is the !ntity "elationship #!-"$model, which yields the basic database blueprint.

    Internal

    he internal model represents the adaptation of the conceptual model to a specific%&S. &asically, the internal model re(uires the database designer to match theconceptual model's characteristics and constraints to those of the selected hierarchical,networ), or relational %&S. herefore, although it is still hardware-independent, it issoftware-dependent.

    External

    he external model represents the applications programmer's view of the dataenvironment. Its use re(uires that the modeler subdivide a universal set of re(uirementsand constraints into functional modules, each represented by its own external model. #he

    modules correspond to business units such as production, sales, personnel, and so on.$!ach external model is represented by its own external schema. !ach business unit is thusrepresented by an external model that includes that unit's entities, the relationshipsbetween the entities, and its constraints. Since external models are defined for a specific%&S, they are %&S #software$-dependent, but hardware-independent.

    he use of external schemas has several important advantages*

    +sing database subsets ma)es it easier to view the specific application program

    re(uirements.

    he subsets ma)e it easier to identify specific data re(uired to support a given

    business unit's operations.

    hey ma)e it easier to examine feedbac) about the conceptual model's ade(uacy.

    It is more difficult to damage the entire database when each module employs only

    the re(uired data subset.

  • 7/26/2019 DATABASE Answers to Review Questions

    2/46

  • 7/26/2019 DATABASE Answers to Review Questions

    3/46

    Physical

    he physical model operates at the lowest level of abstraction. It describes the way datawill be saved on storage media such as dis)s or tapes. &ecause the physical modelre(uires the specification of physical storage devices and the access methods re(uired to

    reach the data located on those storage devices, the physical model is both hardware-andsoftware-dependent. #See section ...$

    . !hat are the main buildin" modules of the #ntity Relationshi$ model% &iscuss

    each one.

    he !-" model contains the following components*

    Entitiesare used to represent real world objects such as professor, class, student, etc./ctually, the !-" model uses entitysets, which are the grouping of related entities. 0or

    example, the entity set named S+%!1 is composed of specific entities such as /nne". orows)i, 2illiam 0. /chero, and so on. So, when !-" models are used, the wordentity actually refers to entity set.

    !ntity types include weakand compositeentities. 2ea) entities have two characteristics*

    1. 'hey are e(istence)de$endent* i.e.* they cannot e(ist without some other

    entity. +#(am$le, P#NN' cannot e(ist without #-P0##.

    . 'he wea2 entity3s $rimary 2ey is $artially or wholly derived from the $arent

    side of the relationshi$.

    3omposite entities are used to transform *1 relationships into sets of 4* relationships.he composite entity's primary )ey consists of the combination of primary )eys from theentitiesit connects.

    0inally, entities may be classified as supertypes and subtypes. In effect, we can create agenerali5ation hierarchy to represent entities that share common characteristics. 0orexample, all !6L78!! entities share attributes such as 1/!, /%%"!SS,97!:6971!, etc. 9owever, special employees such as pilots have attributes, such as0L:I!, not shared by other employees. hus 6IL7 becomes a subtype of thesupertype !6L78!!. #See the detailed discussion in section ..4;$

    Attributesare the characteristics that define an entity. 0or example, the attributes 1/!,/%%"!SS, 6971!, and /

  • 7/26/2019 DATABASE Answers to Review Questions

    4/46

    /ttributes are classified as simpleor composite. / composite attribute is one that can besubdivided to yield additional attributes. 0or example, a phone number can be subdividedinto area code, exchange, and number. / simple attribute cannot be subdivided.

    /ttributes may also be single-valued or multivalued. /s the name suggests, a

    single-valued attribute can have only one value. 0or example, a person can have onlyone gender and one birth date. ultivalued attributes can have many values* / person canhave more than one college degree, and a household may have more than one phone.

    Relationshipsare associations between entities. hus the relationship between the entities6"70!SS7" and 3L/SS is teaches, i.e., a 6"70!SS7" teachesa 3L/SS.

    "elationships are classified by their degree. +nary relationships are those whose entitiesform relationships with themselves, thus producing so-called recursive relationships. 0orexample, a 37+"S! may be aprerequisiteto a 37+"S!.

    &inary relationships, i.e., relationships between two different entities, are most commonand form the basis for most !-" modeling wor). 0or example, a 6IL7 flies an/I"3"/0.

    ernary relationships are those found among three different entities. 0or example, a371"I&+7" contributesto a 0+1%, and a "!3I6I!1 receives fundingfrom that0+1%. 9igher-order relationships than ternary are uncommon in !-" modeling.

    "elationships are also classified as 4*4, 4*, and *1. he term connectivityis used todescribe such classifications. he participation of relationships may also be classified asoptional or mandatory.

    4. !hat is a com$osite entity* and when is it used%

    / composite entity, also )nown as a bridge entity, is one that is used to transform *1relationships into sets of 4* relationships. he composite entity's primary )ey consistsof the combination of primary )eys from the entities it connects. 0or a detailed review ofthe role played by composite entities, refer to the second discussion focus (uestion # 5oware -,N relationshi$s handled in the develo$ment of an #)R dia"ram%$

    6. !hy is data modelin" considered a 7communication tool%7

    %ata are the basic information units used by any system. he problem is that differentgroups of data users view the data from a different perspective. his perspective is basedon a host of factors* 3ler)s or sales personnel have different data needs from thepurchasing manager and the company president. /pplication programmers anddevelopers have yet different views. o use the analogy presented in the boo), differentgroups of information users and producers tend to reflect the =blind men and theelephant= allegory* he one who felt the elephant's tail had (uite a different view of theelephant from the one who felt its trun). 2hat we need is the ability to see the whole

  • 7/26/2019 DATABASE Answers to Review Questions

    5/46

    elephant. Similarly, a house is not a random collection of rooms> if we intend to build ahouse, we should first have an over- all view provided by its blueprint. Similarly, a sounddata environment re(uires the overall view of the data provided by the database blueprint,which is based on a data model.

    o serve as the vehicle for database blueprinting, a good data model helps us understandthe complexities of the real-world environment. Such understanding facilitatescommunication between the various data users and producers. he use of the blueprintanalogy is appropriate because, li)e any building blueprint, the database blueprint basedon a data model enables us to see what data are needed, how the data are to be stored, bywhom the data are to be used, and how the data are related. / good data model ultimatelyenables us to understand how an organi5ation functions, thus enabling us to communicatethe hows and whats to that organi5ation's data users and producers.

    8. Su$$ose you are wor2in" within the framewor2 of the conce$tual model in 9i"ure

    Q4.8,

    9i"ure Q4.8 'he Conce$tual -odel for Question 8

    :iven the conce$tual model in 9i"ure Q4.8* create two e(ternal models.

    9i"ure 4.8A); #(ternal model

  • 7/26/2019 DATABASE Answers to Review Questions

    6/46

    =. 5ow are database models related to the level of data abstraction% +Hint:!hy do

    database desi"ners find it so much easier to develo$ desi"ns based on the

    relational model%

    /1SI?S6/"3 defines four different data models #conceptual, internal, external, and

    physical$ based on three levels of abstraction* high, medium, and low. o a greater orlesser extent, these data models are implemented through a hierarchical, networ), orrelational %&S. #See 0igure .4 in the text.$

    he higher the level of abstraction, the less need for the often difficult-to-understandphysical details.he hierarchical and networ) database models ma)e use of all three levels of abstraction.In contrast,the relational model primarily ma)es use of high and medium degrees of abstraction. Infact, the relational model generally allows its users to focus on the highest and, therefore,easiest to understand, level of abstraction. @iven this focus, the relational implementation

    model lets us ma)e better use of the conceptualdata model. he conceptual model, beinglocated at the abstraction apex, identifies and describes only the main data objects,avoiding the details. /nd it is this conceptual model that underlies the widely used !-"model whose use produces valuable database blueprints.

    >. 5ow would you +"ra$hically identify each of the followin" #)R model

    com$onents%

    a. An entity

    /n entity is represented by a rectangle containing the entity name. #"emember that, in!-" modeling, the word =entity= actually refers to the entity set.$ / weak entity isindicated through the use of a double-line rectangle. / composite entity is identifiedthrough a diamond within a rectangle.

    b. An attribute

    /n attribute is identified by an oval and is connected to the entity through a*

    single line to indicate a single-valued, non-derived attribute

    dotted line to indicate a derived attribute

    double line to indicate multivalued attributes

    he attribute oval contains the attribute name. / primary )ey attribute is

    underlined.

    Aeep in mind that such attribute depictions clutter the !-" presentations and they are,therefore, usually omitted.

  • 7/26/2019 DATABASE Answers to Review Questions

    7/46

    c. A relationshi$

    / relationship is indicated by a diamond-shaped symbol located between the entitieswhose relationship is being described. he diamond contains the relationship description,

    written in lowercase letters. he relationship description is usually an active verb such asteaches, flies, writes, etc. 9owever, the relationship may warrant a more passivedescription to improve the !-" diagram's readability for humans* 6IL7 is an!6L78!!, I1B7I3!:LI1! is contained withinI1B7I3!, etc.

    "elationships are implemented through the use of foreign )eys. "eview the examplegiven in discussion (uestion . #5ow are -,N relationshi$s handled in thedevelo$ment of an #)R dia"ram%$ /lso review the many models and their tablespresented in the chapter.

    ?. 'he 5udson #n"ineerin" :rou$ +5#: has contacted you to create a conce$tual

    model whose a$$lication will meet the e($ected database re@uirements for itstrainin" $ro"ram. 'he 5#: administrator "ives you the followin" descri$tion of

    the trainin" "rou$3s o$eratin" environment,

    'he 5#: has 1 instructors and can handle u$ to 4 trainees $er class. 5#:

    offers five 7advanced technolo"y7 courses* each of which may "enerate several

    classes. If a class has fewer than 1 trainees in it* it will be canceled. It is*

    therefore* $ossible for a course not to "enerate any classes durin" a session. #ach

    class is tau"ht by one instructor. #ach instructor may teach u$ to two classes or

    may be assi"ned to do research. #ach trainee may ta2e u$ to two classes $er

    session.

    :iven this information* do the followin",

    a. &raw the #)R dia"ram for 5#:.

    b. &escribe the relationshi$ between instructor and course in terms of

    connectivity* cardinality* and e(istence de$endence.

    &oth (uestions, a and b, have been addressed in the following !-" diagram. &asically,three sets of relationships exist* / 37+"S! may generate one or more 3L/SSes, anI1S"+37" teaches up to two 3L/SSes, and a "/I1!! may enroll in up to two3L/SSes. / trainee can ta)e more than one class, and each class contains many #4C ormore$ trainees, so there is a *1 relationship between "/I1!! and 3L/SS. #2e must,therefore, create a composite entity to serve as the bridge between "/I1!! and3L/SS.$ / class is taught by only one instructor, but an instructor can teach up to twoclasses. herefore, there is a 4* relationship between I1S"+37" and 3L/SS.0inally, a 37+"S! may generate more than one 3L/SS, while each 3L/SS is based onone 37+"S!, so there is a 4* relationship between 37+"S! and 3L/SS. heserelationships are all reflected in the following !-" diagram. 1ote the optional and

  • 7/26/2019 DATABASE Answers to Review Questions

    8/46

    mandatory relationships* to exist, a 3L/SS must have "/I1!!s enrolled in it, but"/I1!!s do not necessarily ta)e 3L/SSes. #Some may ta)e =on the job training.=$ /nI1S"+37" may not be teaching any 3L/SSes, doing research instead, but each3L/SS must have an I1S"+37". If not enough people sign up for a 3L/SS, a37+"S! may not generate any 3L/SSes, but each 3L/SS must represent a 37+"S!.

    9i"ure Q4.? 'he #)R &ia"ram for 5#:

    B. &iscuss the difference between a com$osite 2ey and a com$osite attribute. 5owwould each be indicated in an #)R dia"ram%

    / composite )ey is one that consists of more than one attribute. / composite attribute isone that can be subdivided to yield attributes for each of its components. If the !-"diagram contains the attribute names for each of its entities, a composite )ey is indicatedin the !-" diagram by the fact that more than one attribute name is underlined to indicateits participation in the primary )ey. here is no !-" convention that enables us to indicatethat an attribute is a composite attribute.

    1. !hat two courses of action are available to a desi"ner when a multivalued

    attribute is encountered%

    he designer can split the multivalued attributes into its components and )eep thesecomponents in the same entity.

    !xamples*

    INS'RC'/R

    teaches

    "enerates

    C.ASS

    'RAIN##

    C/RS#

    #NR/..

    1 1

    -

    -

    - -

    1

    +*

    +1*1

    +1*1+1*1+1*4

    +1*1

    +*

    +*N

    1

  • 7/26/2019 DATABASE Answers to Review Questions

    9/46

    3/" color is decomposed into 7637L7", "I37L7", and &7%837L7".!6L78!! education is decomposed into 9I@9S3977L, 27-8!/"37LL!@!, 07+"-8!/" 37LL!@!, and 67S-@"/%+/!.

    he designer may also create a new entity composed of the multivalued attribute'scomponents and lin) this new entity to the entity in which the multi-valued attributesoccurred originally. his second option is especially desirable when the number ofoutcomes in the multivalued attribute is, for all practical purposes, unlimited. 0orexample, employees classified as =technical= may have certifications in many differentareas and at many different levels.

    11. !hat is a derived attribute% :ive an e(am$le.

    %atabase designers who concentrate on designs that display =design elegance= are veryreluctant to store derived attributes in the database. Instead, they prefer that these derived

    attribute values are computed through appropriate algorithms when they are needed in a(uery. 0or example, a person's age may be calculated by using

  • 7/26/2019 DATABASE Answers to Review Questions

    10/46

    1. 5ow is a relationshi$ between entities indicated in an #)R dia"ram% :ive an

    e(am$le* usin" the Chen and CrowDs foot data models.

    "elationships in the 39!1 model are represented by diamond-shaped symbols. hediamond is placed between the entities whose relationships are being examined. 2ithin

    the diamond-shaped symbol, the relationship description is written #in lowercase letters$to express thekindof relationship that exists between the entities. 1ote the illustrationsin 0igure K.4.

  • 7/26/2019 DATABASE Answers to Review Questions

    11/46

    9i"ure Q4.1 #(am$les of Relationshi$s ;etween #ntities

    14. !hat is a wea2 entity* and how is it re$resented in an #)R dia"ram% :ive an

    e(am$le* usin" the Chen and CrowDs foot data models.

    / wea) entity is one that has 27 identifying characteristics*

    4. It is existence-dependent on another entity, i.e., it cannot exist without the entitywith which it has a relationship.

    . It inherits at least part of their primary )ey from the entity to which it is related.

    he wea) entity is indicated through the display of a double-lined box.

    PR/9#SS/R C.ASSteaches

    CS'/-#R INE/IC#"enerates

    E#N&/R

    E#N&/R

    E#N&/R

    PR/&C'

    INE#N'/R0

    delivers

    .IE#R0

    .IE#R0ma2es INE#N'/R0increases by

    1

    1

    1

    1 1

    1

    -

    -

    - N

    - -

    - -

  • 7/26/2019 DATABASE Answers to Review Questions

    12/46

    16. 5ow is a com$osite entity re$resented in an #)R dia"ram* and what is its

    function% +Illustrate both the Chen and the CrowDs 9oot models.

    In the 3hen model, a composite entity, also )nown as a bridge entity, is represented

    through a diamond contained within a box. he diamond represents a relationship, whilethe box represents an entity. hus the composite entity indicates that it translates a *1relationship into two 4* relationships through an entity. he label =bridge entity= isbased on the fact that a composite entity serves as a connection between other entities.

    he label =composite= is based on the fact that the composite entity contains at least theprimary )ey attributes of each of the entities that are connected by it. he compositeentity is an important component of the !-" model because relational database modelsshould not contain *1 relationships.

    #(am$le,

    / truc)ing company )eeps a log of its truc)ing operations to )eep trac) of its driverGtruc)assignments. he company may assign any given truc) to any given driver many timesand, as time passes, each driver may be assigned to drive many of the company's truc)s*

    Since this *1 relationship should not be implemented, we create the composite entitynamed L7@ whose attributes are defined by the end-user information re(uirements. Inthis case, it may be useful to include L7@:%/!, "+3A:1+, %"IB!":1+,L7@:I!:7+, and L7@:I!:I1.

    1ote that the L7@'s "+3A:1+ and %"IB!":1+attributes are the L7@'s foreign)eys that provide the bridge between the "+3A and %"IB!", respectively. In otherwords, the composite entity must contain at least the primary )eys of the entitiesconnected by it. +sually, this combination of foreign )eys is designated to be thecomposite entity's primary )ey. 9owever, depending on (uery re(uirements, thecomposite entity's primary )ey may be an entirely new attribute, thus producing a tablecontaining two candidate )eys* the designated primary )ey and the combination offoreign )eys that couldhave served as the primary )ey.

    3omposite entities may be named to reflect their component entities. 0or example, anemployee may have several insurance policies #life, dental, accident, health, etc.$, andeach insurance policy may be held by many employees. his *1 relationship isconverted to a set of two 4* relationships, by creating a composite entity named!6:I1S. he !6:I1S entity must contain at leastthe primary )ey components ofeach of the two entities connected by it. 9ow many additional attributes are )ept in thecomposite entity depends on the end-user information re(uirements.

  • 7/26/2019 DATABASE Answers to Review Questions

    13/46

    18. :iven the followin" business rules* create the a$$ro$riate Chen and CrowDs 9oot

    #)R dia"ram for each of the s$ecified relationshi$s,

    a.Acom$anyo$eratesfourde$artments.

    /lthough the company operates four departments now, it may later decide to combineoperations or to expand them. 3learly, the company operates at least onedepartment.

    b. #ach de$artment in $art +a em$loys em$loyees.

    o exist, a department must have at least one employee. o simplify payroll procedures,an employee is li)ely to be assigned to just one department. 9ow many people must beinvolved in a given operation before a department can be formed he answer to that(uestion depends on company policy, which dictates the appropriate business rule. husthe business rule#s$ will ultimately decide the cardinalities.

    c. #ach of the em$loyees in $art b may or may not have one or more de$endents.

    Since an employee is not re(uired to claim a dependent, %!6!1%!1 is optional to!6L78!!. &ecause a company cannot permit the existence of a dependent who is notclaimed by an employee, and because we have chosen to make the DEPENDENTsprimary key a combination of the E!P"#$EEs primary key and the DEPENDENTsnumber, %!6!1%!1 is a wea) entity.

    d. #ach em$loyee in $art +c may or may not have an em$loyment history.

    !ach employee may have an employment history. If a newly hired employee has no priorwor) experience, that employee will not have an employment history, so the !6:9ISis optionalto !6L78!!. Since an employee may have wor)ed for more than oneprevious employer or may have wor)ed in several other departments prior to the currentassignment, there is a 4* relationship between !6L78!! and !6:9IS. 3learly,an employment history is associated with a specific employee and, because we havedecided that the !6:9IS' primary )ey will be a combination of the !6L78!!'sprimary )ey and the !6:9IS's record number, the !6:9IS is both a wea) andoptional entity. In short, the !6:9IS dependencies and primary )ey may be*

    !6:9IS ##-PFN-, 5IS'FIN#, 9IS:8!/", 9IS:%!S3"I6I71, .... etc.$

    #2e have bold-faced the primary )ey components.$ 1ote again that the !6:9IS is awea) entity because of the designers decisionto create its primary )ey in this fashion.

  • 7/26/2019 DATABASE Answers to Review Questions

    14/46

    1=. sin" the #)R dia"ram com$onents develo$ed in @uestion 18* create Chen

    and CrowDs 9oot #)R dia"rams that includes all the com$onents.

    C/-PAN0 PAR'-#N'o$erates

    #-P./0##claims

    1 1

    1

    1

    -

    - -

    -

    P#NN'

    em$loys

    has

    #-PF5IS'

    +1*6 +1*1 +1*N

    +1*1

    +1*1 +*N

    +1*1

    +*N

  • 7/26/2019 DATABASE Answers to Review Questions

    15/46

    1>. !hat three +often conflictin" database re@uirements must be addressed in

    database desi"n%

    %atabase design must reconcile the following re(uirements*

    %esign elegance re(uires that the design must adhere to design rules concerningnulls, derived attributes, redundancies, relationship types, and so on.

    Information re(uirements are dictated by the end users.

    7perational #transaction$ speed re(uirements are also dictated by the end users.

    3learly, an elegant database design that fails to address end user informationre(uirements or one that forms the basis for an implementation whose use progresses at asnail's pace has little practical use.

    1?. ;riefly* but $recisely* e($lain the difference between sin"le)valued attributes andsim$le attributes. :ive an e(am$le of each.

    / single-valued attribute is one that can have only one value. 0or example, a person hasonly one first name and only one social security number. / simple attribute is one thatcannot be decomposed into its component pieces. 0or example, a person's sex isclassified as either or 0 and there is no reasonable way to decompose or 0.Similarly, a person's first name cannot be decomposed into meaningful components. #Incontrast, if a phone number includes the area code, it can be decomposed into the areacode and the phone number itself. /nd a person's name may be decomposed into a firstname, an initial, and a last name.$

    Single-valued attributes are not necessarily simple. 0or example, an inventory code926"I

  • 7/26/2019 DATABASE Answers to Review Questions

    16/46

    1B. !hat are multivalued attributes* and how can they be handled within the

    database desi"n%

    /s the name implies, multi-valued attributes may have many values. 0or example, a

    person's education may include a high school diploma, a -year college associate degree,a four-year college degree, a aster's degree, a %octoral degree, and various professionalcertifications such as a 3ertified 6ublic /ccounting certificate or a 3ertified %ata6rocessing 3ertificate.

    here are basically three ways to handle multi-valued attributes, and two of those threeways arebad*

    4. !ach of the possible outcomes is )ept as a separate attribute within the table. his

    solution is undesirable for several reasons. 0irst, the table would generate many nullsfor those who had minimal educational attainments. +sing the preceding example, aperson with only a high school diploma would generate nulls for the -year collegeassociate degree, the four-year college degree, the aster's degree, the %octoraldegree, and for each of the professional certifications. In addition, how manyprofessional certification attributes should be maintained If you store twoprofessional certification attributes, you will generate a null for someone with onlyone professional certification and you'd generate two nulls for all persons withoutprofessional certifications. /nd suppose you have a person with five professionalcertifications 2ould you create additional attributes, thus creating many more nullsin the table, or would you simply ignore the additional professional certifications,

    thereby losing information

    . he educational attainments may be )ept as a single, variable-length string orcharacter field. his solution is undesirable because it becomes difficult to (uery thetable. 0or example, even a simple (uestion such as =how many employees have four-year college degrees= re(uires string partitioning that is time-consuming at best. 7fcourse, if there is no need to ever group employees by education, the variable-lengthstring might be acceptable from a design point of view. 9owever, as databasedesigners we )now that, sooner or later, information re(uirements are li)ely to grow,so the string storage is probably a bad idea from that perspective, too.

    . 0inally, the most flexible way to deal with multi-valued attributes is to create acomposite entity that lin)s employees to education. &y using the composite entity,there will never be a situation in which additional attributes must be created withinthe !6L78!! table to accommodate people with multiple certifications. In short,we eliminate the generation of nulls. In addition, we gain information flexibilitybecause we can also store the details #date earned, place earned, etc.$ for each of theeducational attainments. he #simplified$ structures might loo) li)e those in 0igureK.4M /-3.

  • 7/26/2019 DATABASE Answers to Review Questions

    17/46

    9i"ure Q4.1B A)C 'he -ultivalued Attribute Solution

    &atabase name, C54FQ#S'INS

    'able name, #-P0## 'able name, #-PF#&C 'able name, #&CA'IN

  • 7/26/2019 DATABASE Answers to Review Questions

    18/46

    9i"ure Q4.1B & 'he Relational Schema for the C54FQ#S'INS

    &atabase

    &y loo)ing at the structures shown in 0igures K.4M /-3, we can tell that the employeenamed "andall earned a high school diploma in 4MN, a &achelor's degree in 4MNM, and a3ertified 1etwor) 6rofessional certification in 4MM. If "andall were to earn a aster'sdegree and a 3ertified %ata 6rocessing certification later, we merely add another tworecords in the !6:!%+3 table. If additional educational attainments beyond thoselisted in the !%+3/I71 table are earned by any employee, all we need to do is add theappropriate record#s$ to the !%+3/I71 table, then enter the employee's attainments inthe !6:!%+3 table. here are no nulls, we have superb (uery capability, and we haveflexibility. 1ot a bad set of design goals;

    he design on which the 0igure K.4M /-3's table structures are based is shown in 0igureK.4M!.

    9i"ure Q4.1B# 'he #R& for the C54FQ#S'INS &atabase

    #-P./0## #-PF#&C #&CA'I/N

    - - 11

    +1*1 +1*1 +*N+1*N

  • 7/26/2019 DATABASE Answers to Review Questions

    19/46

    'he final four @uestions are based on the #)R dia"ram in 9i"ure Q4..

    . !rite the $ro$er cardinalities for +a*bFFF#C,1$FFF +c*dFFF#4,4$FFF+e*fFFF#C,1$FFF

    +"*hFFF#4,4$FFF +i*GFFF#4,4$FFF +2*lFFF#C,1$FF +m*n FFC,1FFF +o*$FF4,4FFF

    1. !rite the $ro$er connectivities for !FF4FF HFFFFF 0FFFFF FF4FFF

    . !hat two attributes mustbe contained in the com$osite entity% se $ro$erterminolo"y in your answer.

    he composite entity must at least include the primary )eys of the entities it references.he combination of these attributes may be designated to be the composite entity's#composite$ primary )ey. !ach of the #composite$ primary )ey's attributes is a foreign )eythat references the entities for which the composite entity serves as a bridge.

    4. &escribepreciselythe com$osition of the wea2 entity3s $rimary 2ey. se $ro$er

    terminolo"y in your answer.

    / wea) entity's primary )ey must be a composite )ey that includes the primary )ey of theentity on which it is existence-dependent. #0or example, note the detailed discussion in(uestion 4 c and d.$

    6. Convert the Chen #R& in 9i"ure Q4. to a CrowDs 9oot #R&.

    Please see file 4)6."if and file 4)6.vsd on the C& and website for the CrowDs foot

    dia"ram for number 6.

    A;C A;F

    A;C

    (((((

    yyyyy

    JK.

    1

    1-

    ! H 0

    -

    +e*f +"*h+a*b

    +c*d

    +m*n +o*$

    +i* G +2* l

  • 7/26/2019 DATABASE Answers to Review Questions

    20/46

  • 7/26/2019 DATABASE Answers to Review Questions

    21/46

    Answers to Problems

    'he first three $roblems are based on the #)R model in 9i"ure P4.1.

    9i"ure P4.1 'he #R& for Problems 1)4

    1. se the followin" business rules to write all a$$ro$riate connectivities in the #)R

    dia"ram,

    a. A de$artment em$loys many em$loyees* but each em$loyee is em$loyed by

    one de$artment.

    he answers to (uestion 4 #all parts$ are included in the !-" diagram that accompanies6roblem .

    b. Some em$loyees* 2nown as 7rovers*7 are not assi"ned to any de$artment.

    c. A division o$erates many de$artments* but each de$artment is o$erated by

    one division

    d. An em$loyee may be assi"ned to many $roGects* and a $roGect may have

    many em$loyees assi"ned to it.

    e. A $roGect must have at least one em$loyee assi"ned to it.

    f. ne of the em$loyees mana"es each de$artment* and each de$artment is

    mana"ed by only one em$loyee.

    &IEISI/N PAR'-#N'

    #-P./0##

    PR/J#C'

    o$erates

    em$loys

    is assi"ned to

    runs

    mana"es

  • 7/26/2019 DATABASE Answers to Review Questions

    22/46

    ". ne of the em$loyees runs each division* and each division is run by one

    em$loyee.

    . !rite all the cardinalities into the model.

    he answer to (uestion is included in the !-" diagram that accompanies 6roblem .

    4. -odify the #)R model by s$littin" the -,N relationshi$ into two 1,-

    relationshi$s that are connected throu"h a com$osite entity. 'hen rewrite the

    connectivities and cardinalities to match the chan"es you have made.

    he completed 3hen !"% is shown in 0igure 6.. 1ote that there are two relationshipsbetween %!6/"!1 and !6L78!!.

    9i"ure P4.4 'he Com$leted Chen #R& for Problems 1)4

    &iscussion,1ote that the !"% shown in 0igure 6.a O and in the 3rowPs 0oot !"%shown in 0igure 6.b -- reflects several useful features that become especially importantwhen the design is implemented. 0or example*

    he /SSI@1 entity is shown to be optional to the 6"7

    sense from a practical perspective, because it lets you create a new project recordwithout having to create a new assignment record. #If a new project is started,there will not yet be any assignments.$

    &IEISI/N PAR'-#N'

    #-P./0##

    PR/J#C'

    o$erates

    em$loys

    runs

    mana"es

    ASSI:N

    1

    1

    1

    1 1

    1

    -

    -

    -

    1

    -

    1+1*N

    +1*1

    +1*1+1*N

    +1*N

    +1*1

    +1*1

    +*N+*1

    +*1

    +*1

    +1*1

  • 7/26/2019 DATABASE Answers to Review Questions

    23/46

    he relationship expressed by Q%!6/"!1 employs !6L78!!R is shown

    as mandatory on the !6L78!! side. his means that a %!6/"!1 musthave at least one !6L78!! in order to have departmental status. 9owever,%!6/"!1 is optional to !6L78!!, so an employee can be entered

    without entering a departmental 0A value. If the existence of nulls is notacceptable, you can create a Q1o assignmentR record in the %!6/"!1 table,to be referenced in the !6L78!! table if an employee is not assigned to adepartment.

    1ote also the implications of the 4*4 Q!6L78!! manages %!6/"!1R

    relationship. he flip side of this relationship is that Qeach %!6/"!1 ismanaged by one !6L78!!R. #his latter relationship is shown as mandatory inthe !"%. hat is, each department mustbe managed by an employee;$ herefore,one of the !6L78!! tablePs 6A valuesmust appear as the 0A value in the%!6/"!1 table. #;ecause this is a 1,1 relationshi$* the inde( $ro$erty of

    the #-PFN- 9K in the PAR'-#N' table must be set to [email protected] $

    /lthough you ought to approach a 4*4 relationship with caution O most 4*4

    relationships are the result of a misidentification of attributes as entities O the 4*4relationships reflected in the Q!6L78!! manages %!6/"!1R andQ!6L78!! runs %ISISI71R are appropriate. hese 4*4 relationships avoid thedata redundancies you would encounter if you duplicated employee data O such anames, phones, and e-mail addresses O in the %IBISI71 and %!6/"!1entities.

    6. Convert the Chen model you have develo$ed in $roblems 1)4 to a CrowDs 9ootmodel. Include at least the minimum number of attributes re@uired to im$lement

    the model.

    If you develop the 3rowPs 0oot !"% shown in 0igure 6., there are some important3rowPs 0oot features to )eep in mind.

    If you have multiple relationships between two entities -- such as the

    Q!6L78!! manages %!6/"!1R and Q%!6/"!1 employs!6L78!!R relationships O you must ma)e sure that each relationship has adesignated primary entity. 0or example, the 4*4 relationship expressed byQ!6L78!! manages %!6/"!1R re(uires that the !678!! entity bedesignated as the primary #or QfirstR$ entity. If you use Bisio to create your 3rowPs0oot !"%s, 0igures 6.a and b show how the 4*4 relationship is specified. Ifyou use some other 3/S! tool, you will discover that it, too, is li)ely to re(uiresimilar relationship specifications.

  • 7/26/2019 DATABASE Answers to Review Questions

    24/46

    he 3rowPs 0oot !"% in 0igure 6. contains attribute information that is not

    available in the 3hen model. In addition, the nature of the relationships#identifying or non-identifying$ is immediately obvious. 1ote also that the/SSI@1 entity was renamed /SSI@1!1 O the 3rowPs 0oot entityspecification provided plenty of room to expand the name to its proper noun

    specification. #/SSI@1 might be interpreted as a verb.$

    0igure 6. he 3ompleted 3rowPs 0oot !"% for 6roblems 4-

    9i"ure P4.6aEisio Cardinality &esi"nation 9i"ure P4.6b Eisio 9K &esi"nation

  • 7/26/2019 DATABASE Answers to Review Questions

    25/46

    8. 'em$orary #m$loyment Cor$oration +'#C $laces tem$orary wor2ers in

    com$anies durin" $ea2 $eriods. '#C3s mana"er "ives you the followin"

    descri$tion of the business,

    '#C has a file of candidateswho are willin" to wor2.

    If the candidate has wor2ed before* that candidate has a s$ecific !ob history.

    +Naturally* no Gob history e(ists if the candidate has never wor2ed. #ach time

    the candidate wor2ed* one additional Gob history record was created.

    #ach candidate has several "uali#ications. #ach @ualification may be earned

    by more than one candidate. +9or e(am$le* it is $ossible for more than one

    candidate to have earned a ;;A de"ree or a -icrosoft Networ2 Certification.

    And clearly a candidate may have earned a ;;A and a -icrosoft Networ2

    Certification.

    '#C also has a list of companiesthat re@uest tem$oraries.

    #ach time a com$any re@uests a tem$orary em$loyee* '#C ma2es an entry

    in the openings folder. 'his folder contains an o$enin" number* com$any

    name* re@uired @ualifications* startin" date* antici$ated endin" date* and

    hourly $ay.

    #ach o$enin" re@uires only one s$ecific or main @ualification.

    !hen a candidate matches the @ualification* +she is "iven the Gob* and an

    entry is made in the Placement Record folder. 'his folder contains an

    o$enin" number* candidate number* total hours wor2ed* and so on. In

    addition* an entry is made in the Gob history for the candidate.

    '#C uses s$ecial codes to describe a candidate3s @ualifications for an

    o$enin". 'he list of codes includes,

    Code $escription

    S#C)68 Secretarial wor2* at least 68 words $er minuteS#C)= Secretarial wor2* at least = words $er minute

    C#RK :eneral cler2in" wor2

    PR:)E; Pro"rammer* Eisual ;asic

    PR:)C Pro"rammer* C

    &;A)R &atabase Administrator* RAC#

    &;A)&; &atabase Administrator* &;

    S0S)1 Systems Analyst* level 1

  • 7/26/2019 DATABASE Answers to Review Questions

    26/46

    S0S) Systems Analyst* level

    N!)NE Networ2 administrator* Novell e($erience

    '#C3s mana"ement wants to 2ee$ trac2 of the followin" entities,

    C-PAN0P#NIN:

    QAI9ICA'IN

    CAN&I&A'#

    J;F5IS'R0

    PAC#-#N'

    :iven this information* do the followin",

    a. &raw the CrowDs 9oot #)R dia"ram for this enter$rise.

    b. Identify all $ossible relationshi$s.

    c. Identify the connectivity for each relationshi$.

    d. Identify the mandatory/o$tional de$endencies for the relationshi$s.

    e. Resolve all -,N relationshi$s.

    6roblems Ea-e are answered in the !-" diagram. Shown in 0igure 6.E.

    9i"ure P4.8 'he #R& for Problem 4.8

    C/-PAN0

    /P#NIN:

    lists

    P.AC#-#N'

    creates

    matches

    QA.I9ICA'I/N

    CAN&I&A'#

    CANFQA.

    has

    5IS'/R0

    1

    1

    1

    1 1

    1 1

    1

    1

    - -

    --

    -

    -

    -

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +1*N

    +1*N

    +*N+*N

    +*N

    +*N

    +1*1

    +1*1

    +*1

    +*N

  • 7/26/2019 DATABASE Answers to Review Questions

    27/46

    o help the students understand the !-" diagram's components better, the followingdiscussion is li)ely to be useful*

    !ach 376/18 may list one or more 76!1I1@s. &ecause we will maintain

    376/18 data even if a company has not #yet;$ hired any of !3's candidates,

    76!1I1@ is an optional entity in this relationship. 76!1I1@ is existence-dependenton 376/18, because there cannot be an opening unless it is listed by a company.&ecause we have decided to use the 376/18 primary )ey as a component of the76!1I1@'s primary )ey, we have satisfied the conditions that will allow us toclassify 76!1I1@ as a wea) entity.

    !ach job 3/1%I%/! mayhave many job 9IS7"8 entries. &ut )eep in mind that

    a candidate may just have competed job training and, therefore, may not have had jobexperience #i.e., no job history$ yet. In short, 9IS7"8 is optional to 3/1%I%/!.7n the other hand, a job candidate may have had many jobs #remember, !3 is atemp employer;$ and, therefore, would have many entries in 9IS7"8. 0inally,

    9IS7"8 is clearly existence-dependent on 3/1%I%/!> it is not possible to ma)ean entry in 9IS7"8 without having a 3/1%I%/! to generate that history. 2ewill use the 3/1%I%/! primary )ey as one of the components of the 9IS7"8'sprimary )ey, thus allowing us to classify 9IS7"8 as a wea) entity.

    !ach 3/1%I%/! may have earned one or more K+/LI0I3/I71s. /lthough a

    (ualification may be listed by a company, there may not be a matching candidatebecause it is possible that none of the candidates have this (ualification. 0or instance,it is possible that none of the available candidates is a 6ascal programmer. herefore,3/1%I%/! is optional to K+/LI0I3/I71. 9owever, many candidates may

    have a given (ualification. 0or example, many candidates may be 3JJ programmers./nd each (ualification may be matched to many job candidates, so the relationshipbetween 3/1%I%/! and K+/LI0I3/I71 is *1. his relationship must bedecomposed into two 4* relationships with the help of a composite entity we willname 3/1:K+/L.

    !ach job 76!1I1@ re(uires one K+/LI0I3/I71, and any given (ualification

    may fit many openings, thus producing a 4* relationship betweenK+/LI0I3/I71 and 76!1I1@. 0or example, a job opening for a 3JJprogrammer re(uires an applicant to have the 3JJ programming (ualification, butthere may be many job openings for 3JJ programmers; 9owever, a (ualification

    does notre(uire an opening. #/fter all, if there is no listing with a 3JJ re(uirement,a candidate who has the 3JJ (ualification does not match the listing;$ herefore,76!1I1@ is optional to K+/LI0I3/I71. &ecause there cannot be a listedopening unless it also lists the re(uired (ualification for that opening, the 76!1I1@is existence-dependent on K+/LI0I3/I71. 2e will use the K+/LI0I3/I71primary )ey as a component of the 76!1I1@'s #composite$ primary )ey. &ecause76!1I1@ is existence-dependent on K+/LI0I3/I71 and because it borrows theK+/LI0I3/I71's primary )ey as component of its own primary )ey, 76!1I1@ is

  • 7/26/2019 DATABASE Answers to Review Questions

    28/46

    properly classified as a wea) entity to K+/LI0I3/I71.

    / listed job opening may be filled by one or more candidates. /lso, )eep in mind

    that, during some period of time, a candidate may fill manyopenings. #!3 suppliestemporaries, remember$ herefore, the relationship between 76!1I1@ and

    3/1%I%/! is *1. 2e will decompose this *1 relationship into two 4*relationships, using the composite entity named 6L/3!!1 as the bridge between3/1%I%/! and 76!1I1@. &ecause there is not necessarily an opening for eachcandidate, 76!1I1@ is optional to 3/1%I%/!. Similarly, since an 76!1I1@may be listed even when there is no available candidate, 3/1%I%/! is optional to76!1I1@. 1ote the migration of the optional symbols in the !-" diagram. #8ou maywonder why we show 76!1I1@ as a wea) entity in the !-" diagram. /ctually,76!1I1@ was declared a wea) entity in our earlier discussion concerning the76!1I1@'s relationship to 376/18;$ /lso, remind the students that, although anopening may not have an available candidate, and a candidate may not fit an opening,the actual placement of a candidate clearly demonstrates that there was a match

    between a candidate and a listed opening;

    here exists an entry in 9IS7"8 for every 6L/3!!1 entry, but not all

    9IS7"8 entries will have a matching placement entry. In other words, all6L/3!!1 entries will have a matching 9IS7"8 entry, but 6L/3!!1 isoptionalto 9IS7"8 because a position may have been filled by the candidate ratherthan through the !3 services;

  • 7/26/2019 DATABASE Answers to Review Questions

    29/46

    =. 'he Jonesbur"h County ;as2etball Conference +JC;C is an amateur bas2etball

    association. #ach city in the county has one team that re$resents it. #ach team

    has a ma(imum of 1 $layers and a minimum of nine $layers. #ach team also has

    u$ to three coaches +offensive* defensive* and P' coaches. #ach team $lays two

    "ames +home and visitor a"ainst each of the other teams durin" the season.

    :iven these conditions* do the followin",

    a. Identify the connectivity of each relationshi$.

    b. Identify the ty$e of de$endency that e(ists between CI'0 and '#A-.

    c. Identify the cardinality between teams and $layers* and between teams and

    city.

    d. Identify the de$endency between coach and team* and between team and$layer.

    e. &raw the Chen and CrowDs 9oot #)R dia"ram to re$resent the JC;C database.

    6roblems Da-De are all completed in the !-" diagram shown in 0igure 6.D.

    9i"ure P4.= 'he #R& for the JC;C &atabase

    :A-#

    CI'0 s$onsors has

    uses

    P.A0#R

    C/AC5

    '#A-

    - -

    -

    -

    1 1 1 1 1

    1+1*1 +1*1

    +1*1

    +1*4+1*1+B*1

    +*N +*N

    +1*1 +1*1

  • 7/26/2019 DATABASE Answers to Review Questions

    30/46

    o help the students understand the !-" diagram's components better, note the followingrelationships*

    he main components are !/ and @/!.

    !ach team plays each other team at leasttwice.

    o play a game, two teams are necessary* the home team and the visitor team.

    !ach team plays once as the home team and once as the visitor team.

    @iven these relationships, it becomes clear that !/ participates in a recursive*1relationship with @/!. he relationship between !/ and @/! becomes clearerif we list some attributes for each of these entities*

    @/! entity !/ entity

    @/!:1+ !/:1+@/!:%/! !/:1/!@/!:97!:!/ !/:3I8@/!:BISI:!/@/!:97!:67I1S 1ote* !/:1+ appears at least twice in a@/!*@/!:BISI:67I1S once as @/!:97!:!/ and once

    as @/!:BISI:!/.

    >. Automata Inc. $roduces s$ecialty vehicles by contract. 'he com$any o$erates

    several de$artments* each one of which builds a $articular vehicle* such as a

    limousine* a truc2* a van* or an RE.

    !hen a new vehicle is built* the de$artment $laces an order with the Purchasin"

    &e$artment to re@uest s$ecific com$onents. Automata3s Purchasin" &e$artment

    is interested in creatin" a database to 2ee$ trac2 of orders and to accelerate the

    $rocess of deliverin" materials.

    'he order received by the Purchasin" &e$artment can contain several different

    items. An inventory is maintained so that the most fre@uently re@uested items aredelivered almost immediately. !hen an order comes in* it is chec2ed to determine

    whether the re@uested item+s is +are in inventory. If an item is not in inventory*

    it must be ordered from a su$$lier. #ach item may have several su$$liers.

    :iven this functional descri$tion of the $rocesses encountered at Automata3s

    Purchasin" &e$artment* do the followin",

  • 7/26/2019 DATABASE Answers to Review Questions

    31/46

    a. Identify all the main entities.

    1ote* 6roblems #a$ through #c$ are answered in the !-" diagram following answer #c$.

    b. Identify all the relations and connectivities amon" entities.

    c. Identify the ty$e of e(istence de$endency in all relations.

    9i"ure P4.> 'he #R& for Problem >

    d. :ive some e(am$les of the ty$es of re$orts that can be obtained from the

    database.

    2ith this database the following reports can be obtained, among others*

    report of suppliers and items supplied by each.

    number of orders placed by each department, including the re(uested items.

    an updated inventory report showing stoc) (uantities, components that need to be

    reordered, etc.

    ?. Create an #R& based on the CrowDs 9oot model* usin" the followin"

    re@uirements.

    An INEIC# is written by a SA#SR#P. #ach sales re$resentative can

    write many invoices* but each invoice is written by a sin"le sales

    re$resentative.

    'he INEIC# is written for a sin"le CS'-#R. 5owever* each customer

    can have many invoices.

    PAR'-#N'

    $laces

    /RR /R&FI'#-

    I'#-FSP

    I'#-

    SPP.I#R

    -- -

    -

    -

    1

    1 1 1

    1

    +1*1

    +1*1 +1*1

    +1*1

    +1*1

    +1*N +1*N

    +1*N

    +1*N+1*N

  • 7/26/2019 DATABASE Answers to Review Questions

    32/46

    An INEIC# may include many detail lines +IN# which describe the

    $roducts bou"ht by the customer.

    'he $roduct information is stored in a PR&C' entity.

    'he $roduct3s vendor information is found in a E#N&R entity.

    Note, 'he #R& must reflect business rules that you are +within

    reason free to define. -a2e sure that your #R& reflects the

    conditions you re@uire. 9inally* ma2e sure that you include the

    attributes that would $ermit the model to be successfully

    im$lemented.

    9i"ure P4.? 'he #R& for Problem ?

    CS'/-#R

    "enerates

    INE/IC#

    writes

    SA.#SR#P

    INEF.IN# PR/&C'

    S5IP-#N'

    E#N&/R

    1

    1 1

    1

    1

    1

    -

    -

    - -

    -

    -

    +1*N

    +1*N

    +1*N

    +1*N

    +1*N

    +1*1

    +1*1 +1*1 +1*1

    +1*1

    +1*1

    +1*N

  • 7/26/2019 DATABASE Answers to Review Questions

    33/46

    9i"ure P4.?A 'he Revised #R& for Problem ?

    B. :iven the followin" brief summary of business rules for the R;CR caterin"

    service* and usin" the CrowDs 9oot #)R methodolo"y* draw the fully)labeled #R&.

    -a2e sure to include all a$$ro$riate entities* relationshi$s* connectivities* and

    cardinalities.

    Note, imit your #R& to entities and relationshi$s based on the

    business rules shown here. In other words* do N' add 7realism7 to

    your desi"n by e($andin" or refinin" the business rulesO 5owever*

    ma2e sure that you include the attributes that would $ermit the model

    to be successfully im$lemented.

    #ach dinner is based on a sin"le entree* but each entree can be served at many

    dinners. A "uest can attend many dinners* and each dinner can be attended by

    many "uests. #ach dinner invitation can be mailed to many "uests* and each "uest

    can receive many invitations.

    CS'/-#R

    "enerates

    INE/IC#

    writes

    SA.#SR#P

    1

    1

    -

    -

    +1*N

    +1*N

    +1*1

    +1*1

    contains INEF.IN# is in

    1

    1

    -

    +1*N

    +1*1

    PR/&C'

    /RR

    E#N&/R

    shows in

    shi$s

    -

    -- 1

    +1*1 +1*1+1*N +*N

    +1*1

    +*N

    1

  • 7/26/2019 DATABASE Answers to Review Questions

    34/46

    9i"ure P4.B 'he #R& for Problem B

    1. sin" the CrowDs 9oot methodolo"y* create an #R& that can be im$lemented for

    a medical clinic* usin" at leastthe followin" business rules,

    A $atient can ma2e many a$$ointments with one or more doctors in the

    clinic* and a doctor can acce$t a$$ointments with many $atients. 5owever*

    each a$$ointment is made with only one doctor* and each a$$ointment

    references a sin"le $atient.

    #mer"ency cases do not re@uire an a$$ointment. 5owever* an emer"ency isentered into the a$$ointment boo2 as 7unscheduled7 for a$$ointment

    mana"ement $ur$oses.

    If 2e$t* an a$$ointment yields a visit with the doctor s$ecified in the

    a$$ointment. 'he visit yields a dia"nosis and* when a$$ro$riate* treatment.

    #ach visit u$dates the $atient3s records to $rovide a medical history.

    #ach $atient visit creates a bill. #ach $atient visit is billed by one doctor* and

    each doctor can bill many $atients.

    #ach bill must be $aid. 5owever* a bill may be $aid off in many installments*

    and a $ayment may cover more than one bill.

    A $atient may $ay the bill directly* or the bill may be the basis for a claim

    submitted to an insurance com$any.

    #N'R##

    &INN#R :#S'

    is $art of

    A''#N&ANC#

    INEI'A'I/N

    1

    1

    1

    1 1- - -

    - -

    +1*1

    +1*1

    +1*1 +1*1

    +1*1 +1*N+*N+1*N+1*N

    +1*N

  • 7/26/2019 DATABASE Answers to Review Questions

    35/46

    If the bill is $aid by an insurance com$any* the deductible is submitted to the

    $atient for $ayment.

    9i"ure P4.1 'he #R& for Problem 1

    PA'I#N' APP/IN'-#N'

    u$dates EISI'

    $roduces

    ;I..

    C5:F.IN#

    CA'#:/R0

    PA0F;I..

    PA0-#N'

    submitsma2es

    PA'FPA0 INSFPA0

    sends

    $ays

    has creates

    C.AI-

    yields

    INSRANC#

    &/C'/R

    ma2es

    - - -

    -

    - -

    -

    -

    -

    -

    -

    -

    1

    1 1

    1

    1 1

    1 11

    1

    1

    1

    1

    11

    1 1

    1

    1

    1

    1

    +1*1 +1*1

    +1*1+1*1

    +1*1

    +1*1

    +1*1+1*1+1*1

    +1*1+1*1

    +1*1 +1*1

    +1*1

    +1*1

    +*1+1*1

    +1*1 +*1

    +1*1

    +1*N +1*N+1*N

    +1*N

    +1*N

    +1*N

    +1*N

    +1*N+*1

    +1*1

    +1*N

    +1*-

    +1*N +1*N

  • 7/26/2019 DATABASE Answers to Review Questions

    36/46

    11. 'iny Colle"e is so $leased with your desi"n and im$lementation of its student

    re"istration/ trac2in" system that it wants you to e($and the desi"n to include its

    motor $ool. A brief descri$tion of o$erations follows,

    9aculty members may use the 'iny Colle"e)owned vehicles for officially)

    sanctioned travel. 9or e(am$le* its vehicles may be used by faculty members totravel to off)cam$us learnin" centers* to travel to locations at which research

    $a$ers are $resented* to trans$ort students to officially sanctioned locations* and

    to travel for $ublic service $ur$oses. 'he vehicles used for such $ur$oses are

    mana"ed by 'iny Colle"e3s '9;S +'ravel 9ar ;ut Slow Center.

    sin" reservation forms* each de$artment may reserve vehicles for its faculty*

    who are res$onsible for fillin" out the a$$ro$riate tri$ com$letion form at the

    end of each tri$. 'he reservation form includes the e($ected de$arture date*

    vehicle ty$e re@uired* destination* and the authoried faculty member. !hen the

    faculty member arrives to $ic2 u$ the vehicle* +she must si"n a chec2)out form

    to lo" the vehicle out and to $ic2 u$ a tri$ com$letion form. +'he '9;Sem$loyee who releases the vehicle for use also si"ns the chec2)out form. 'he

    faculty member3s tri$ com$letion form includes the faculty member3s

    identification code* the vehicle3s identification* the odometer readin"s at the start

    and end of the tri$* maintenance com$laints* if any* "allons of fuel $urchased* if

    any* and the earnwell Colle"e credit card used to $ay for such fuel. If fuel has

    been $urchased* the credit card recei$t must be sta$led to the tri$ com$letion

    form. $on recei$t of the 9aculty 'ri$ Com$letion form* the faculty member3s

    de$artment is billed at a milea"e rate based on the vehicle ty$e +sedan* station

    wa"on* $anel truc2* minivan* minibus used. HI%&: $o %'& use more entities

    than are necessary( Remember the di##erence between attributes and entities)

    All vehicle maintenance is $erformed by '9;S. #ach time a vehicle re@uires

    maintenance* a maintenance lo" entry is com$leted on a $re)numbered

    maintenance lo" form. 'he maintenance lo" form includes the vehicle

    identification* a brief descri$tion of the ty$e of maintenance re@uired* the initial

    lo" entry date* the date on which the maintenance was com$leted* and the

    identification of the mechanic who released the vehicle bac2 into service. +nly

    mechanics who have an ins$ection authoriation may release the vehicle bac2

    into service.

    As soon as the lo" form has been initiated* the lo" form3s number is transferred

    to a maintenance detail form the lo" form3s number is also forwarded to the

    $arts de$artment mana"er* who fills out a $arts usa"e form on which the

    maintenance lo" number is recorded. 'he maintenance detail form contains

    se$arate lines for each maintenance item $erformed* the $arts used* and the

    identification of the mechanic who $erformed the maintenance item. !hen all

    the maintenance items have been com$leted* the maintenance detail form is

    sta$led to the maintenance lo" form* the maintenance lo" form3s com$letion date

    is filled out* and the mechanic who releases the vehicle bac2 to service si"ns the

  • 7/26/2019 DATABASE Answers to Review Questions

    37/46

    form. 'he sta$led forms are then filed* to be used later as the source for various

    maintenance re$orts.

    ';9S maintains a $arts inventory* includin" oil* oil filters* air filters* belts of

    various ty$es* and so on. 'he $arts inventory is monitored daily to monitor $arts

    usa"e and to re)order $arts that reach the 7minimum @uantity on hand7 level.

    'o trac2 $arts usa"e* the $arts mana"er re@uires each mechanic to si"n out the$arts that are used to $erform each vehicle3s maintenance the $arts mana"er

    records the maintenance lo" number under which the $art is used.

    #ach month* '9;S issues a set of re$orts. 'hese re$orts include the milea"e

    driven by vehicle* by de$artment* and by faculty members within the

    de$artment. In addition* various 7revenue7 re$orts are "enerated by vehicle and

    de$artment. A detailed $arts usa"e re$ort is also filed each month. 9inally* a

    vehicle maintenance summary is created each month.

    :iven this brief summary of o$erations* draw the a$$ro$riate +and fully)

    labeledO #)R dia"ram. se the Chen methodolo"y to indicate entities*relationshi$s* connectivities* and cardinalities.

    9i"ure P4.11 'he #R& for Problem 11

    ./:

    writes

    enters

    E#5IC.#

    indicates

    '0P#

    defines

    C5AR:# "enerates

    $ays

    is in

    is found in

    references

    yields ./:F.IN#

    si"ns

    uses PAR'

    re@uires

    SI:NF/'-#C5ANIC ma2es

    R#S#REA'I/N ma2es

    yields

    C5#CKF/' re@uires

    PAR'-#N'

    em$loys

    9AC.'0 is an

    #-P./0##

    initials

    matches

    - - -

    - -

    -

    -

    - -

    - -

    -

    1

    1 1 1

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1 1

    1

    1

    1

    1

    1

    +1*N

    +1*N

    +1*N

    +1*N+1*N

    +1*N

    -

    +1*N

    +1*N

    +1*N+1*N

    +1*N

    +1*N

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    --

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +*N

    +*N

    +*N

    +*11

    +1*1

    +1*1

    +1*1

    +*1

    +1*1

    +1*1

    +*N

    +1*1

    +*1

    +*N

    +1*1+*1

    -

    +1*1

  • 7/26/2019 DATABASE Answers to Review Questions

    38/46

    0igure 6.44's !-" diagram has been rendered at the implementation level. hat is, wehave converted all composite entity relationships by naming them, thus eliminating theneed to show the diamonds within the boxes. he following conditions are reflectedwithin the !-" diagram*

    &ecause a vehicle can re(uire maintenance many times and each maintenanceprocedure re(uires a new log entry, the relationship between B!9I3L! and L7@is 4*. &ecause even a new vehicle is chec)ed initially through the maintenancedepartment, the relationship is mandatory.

    he /I1!1/13! entity is shown as wea) to L7@, because the maintenance

    detail is defined partially by the log number and, (uite clearly, a maintenancedetail form is existence-dependent on the log entry.

    Some maintenance does not re(uire parts. 0or example, the adjustment of a fuel

    injector jet only re(uires a mechanic's time. herefore, 6/" is optional to

    /I1!1/13! in this relationship. 7n the other hand, a given vehicle may usemany parts during a maintenance operation.

    If a part is re(uired, it must be signed out. /ny part can be signed out many times.

    0or example, if the parts inventory includes E hose clamps, a hose clamp can besigned out E times. #1ot thesameone, of course.... but each time a hose clamp isused, that hose clamp part number shows up in the SI@1:7+;$

    !ach maintenance line must be signed off by a mechanic and, if a mechanic does

    any maintenance wor), that mechanic is re(uired to sign off on that wor). If amechanic performs many tas)s on a given vehicle during its maintenance, that

    mechanic signs off many times, once for each completed tas).

    7nly mechanics who have an inspection authori5ation can sign off the L7@, so

    L7@ is optional to !39/1I3 in the !39/1I3 creates L7@ #entry$. &ut amechanic with an inspection authori5ation can sign off many logs.

    1ot all departments ma)e reservations for the use of iny 3ollege vehicles, so

    "!S!"B/I71 is optional to %!6/"!1. 7n the other hand, if areservation is made, it must have been made by a department, so %!6/"!1is mandatory to "!S!"B/I71.

    0aculty members may ta)e many trips during some period of time, thus

    generating many chec)-outs. 9owever, not all faculty members use the iny3ollege vehicles, so 39!3A:7+ is optional to 0/3+L8.

    !ach chec)-out generates a charge and each charge is related to one chec)-out.

  • 7/26/2019 DATABASE Answers to Review Questions

    39/46

    !ach charge is determined by the number of miles driven #recorded in

    39!3A:7+$ and the charge per mile recorded by vehicle 86!.

    he students may find it helpful if the instructor also shows the composite relationships atthe #more conceptual$ composite level. It may also be useful to show several different

    types of composite entities that perform the same )inds of functions. 0or example, notethe similarities between the !-" segments shown in 0igure 6.4C/.

    9i"ure P4.11A 'he #R& Se"ments at the Conce$tual evel

    It may also be useful to discuss a scenario in which the "!S!"B/I71, 39!3A:7+,and 39/"@! attributes are )ept in a single table, thus simplifying the design byeliminating the 4*4 relationships between "!S!"B/I71, 39!3A:7+ and39/"@!. he combined entity, named "!S:39A7+, would then yield a table withthese attributes*

    Attribute name Sam$le values

    "!S:1+ 4"!S:%/! 4CG4EGMD!6:1+ EE%!6:37%! 3IS86!:37%! S"!S:6I3A:+6 44GGMDB!9:1+ 09@-4

    0/3:1+ E4"!S:"!+"1 44GNGMD"!S:IL!S NE."!S:376L/I1S %ashboard rattles at low rpm, rough idling"!S:37S TN.EC"!S:"!0 BIS/"!S:&ILL TNE.D

    INE/IC#

    INEF.IN#

    PR/&C'

    1

    -

    -

    1

    +1*N

    +1*N

    +1*1

    +1*1

    ./:

    ./:F.IN#

    1

    -

    -

    1

    +1*N

    +1*N

    +1*1

    +1*1

    PAR'

    -#C5ANIC

    SI:NF/'

    1

    -

    -

    1

    +1*N

    +1*N

    +1*1

    +1*1

    PAR'

    -#C5ANIC

    -#C5FQA.

    1

    -

    -

    1

    +1*N

    +1*N

    +1*1

    +1*1

    QA.I9ICA'I/N

  • 7/26/2019 DATABASE Answers to Review Questions

    40/46

    &he problem with the preceding solution is that many o# the attributes are set to null

    until the vehicle is returned( In #act* the vehicle and #aculty numbers are set to null

    until the vehicle is picked up(

    1. :iven the followin" information* $roduce an #R& based on the CrowDs 9oot

    model that can be im$lemented. -a2e sure to include all a$$ro$riate entities*relationshi$s* connectivities and cardinalities.

    #ver9ail com$any is in the @uic2 oil lube business. Althou"h customers brin"

    in their cars for what is described as @uic2 oil chan"es* #ver9ail also re$laces

    windshield wi$ers* oil filters* and air filters* subGect to customer a$$roval. 'he

    invoice contains the char"es for the oil used* all $arts used* and a standard labor

    char"e. !hen the invoice is $resented* customers $ay cash* use a credit card* or

    write a chec2. #ver9ail does not e(tend credit. #ver9ail3s database is to be

    desi"ned to 2ee$ trac2 of all com$onents in all transactions.

    :iven the hi"h $arts usa"e of the business o$erations* #ver9ail must maintaincareful control of its $arts +oil* wi$ers* oil filters* air filters inventory. 'herefore*

    if $arts reach their minimum on hand @uantity* the $art in @uestion must be

    reordered from an a$$ro$riate vendor. #ver9ail maintains a vendor list which

    contains both the vendors actually used as well as $otential vendors.

    Periodically* #ver9ail mails u$dates to customers* based on the date of the car3s

    service. #ver9ail also trac2s each customer3s car milea"e.

    he solution to this problem is found in 0igure 6.4.

  • 7/26/2019 DATABASE Answers to Review Questions

    41/46

    9i"ure P4.1 'he #R& for Problem 1

    CAR

    CSFCAR

    CS'/-#R "enerates INE/IC#

    INEF.IN#

    PAR'

    /RR

    E#N&/R

    1

    1 1 1

    1

    1

    -

    -

    -

    -

    -

    --

    +1*N

    +1*N

    +*N +1*N

    +*N

    +*N +*N

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    +1*1

    /R&F.IN#

    +1*N

    +1*11-

    shi$s

  • 7/26/2019 DATABASE Answers to Review Questions

    42/46

    14. se the followin" descri$tions of the o$erations of RCF-odels Com$any to

    com$lete this e(ercise.

    /.

    A customer may generate many invoices

    Each invoice is generated by only one customer

    %ome customers have not &yet' generated an invoice Some customers come from 0ineScale odelerPs maga5ine # I only put this in

    here because I suspect that the company will want to )now how many peoplefrom 0ineScale odelerPs maga5ine became customers$

    / customer has one address

    / customer can ship to many addresses

    / billing address and shipping address can be different

    / product belongs to at least one product category # he description does not

    indicate more than two categories, model and decals, but a better design wouldinclude the possibility for multiple overlapping categories O ie. 1ot only model

    and decals but 22II, Sci0i, "ailroad, etc.$ / product is made by at least one manufacture

    / product can be made by many manufactures

    / product is a product at a particular scale #the description claims that a product

    has many scales, but things li)e units in stoc), reorder U, manufacturer partnumber etc wor) better if a product has a single scale and then are grouped byproduct group O I also tossed around the idea of having something called an VitemPthat was a product at a particular scale but it degenerated into a product that is partof a product group$.

    / product has n units in stoc)

    / product has a retail #customer$ price

    / product has a low water mar) #reorder product when stoc) drops below this

    value$

    / product has a last reorder date

    / product has a last sold date #last time this product was sold to a customer$

    /n invoice has 4 or more products

    /n invoice has a shipping charge

    /n invoice has sales tax

    /n invoice must be in one and only one state #Vorder createdP, Vbac) orderedP,

    Vchec)ing creditP, Vwaiting for pac)ingP, VbilledP, Vwaiting for shippingP, andVshippedP$

    /n invoice has a timestamp for each state change /ll items in a Vwaiting for pac)ingP order must be in stoc)

    /n invoice has a payment voucher for the correct amount

    /n invoice has a shipping address

    / payment voucher has a card number, billing address, expiration date, holder

    name, W #17!* a better design would have a payment voucher abstraction so

  • 7/26/2019 DATABASE Answers to Review Questions

    43/46

    the database could handle Vstore creditP for returned items, gift cards, andcoupons$

    / product re(uest has a customer

    / product re(uest has a date

    / product re(uest has one or more products that information was re(uested about

    / manufacturer has an address / manufacturer has a order web site

    / manufacturer has a minimum order si5e re(uirement by product

    / reorder slip has an ordered timestamp and an order received timestamp

    / reorder slip has a list of products, (uantities, and price

    / manufactureGproduct pair has a whole sale #"3:odels$ price

    Simplifications of the model

    "emove source code from customer

    "emove product category and category map tables and replace with a category

    type field in the products table

    "emove invoice state table and replace with code or text in invoice table

  • 7/26/2019 DATABASE Answers to Review Questions

    44/46

    ;. Please see the additional files named 4)14."if* 4)14.vsd* and 4)141Fraster."if

    located on the C& and website.

    16. se the followin" descri$tion of the o$erations of the RCFCharter

    Com$any to com$lete this e(ercise.A.

    A customer may request many charter trips

    A charter trip is requested by only one customer

    %ome customers have not &yet' requested a charter trip

    An employee may be assigned to many charter trips

    Each charter trip may have many employees assigned to it

    !ach charter trip has one and only one plane assigned to it

    !ach charter trip may have 5ero or more passengers

    !ach charter trip may have 5ero or more items of cargo

    !ach charter trip may have 5ero or more associated crew expenses !ach charter trip has two or more legs

    !ach charter trip may have 5ero or more customer special charges

    !ach customer has a line or credit for 5ero dollars #+S$ or more

    !ach customer has used 5ero dollars #+S$ or more of their credit on prior trips

    !ach customer may have made 5ero or more payments to their account

    !ach customer may have made one or more special re(uests resulting in one or

    more special charges on one or more trips

    / special charge applies to one and only one customer and trip

    !ach leg of a trip may have incurred a wait time

    !ach leg of a trip consumes fuel !ach leg of a trip has a departure and arrival time

    !ach leg of a trip belongs to one and only one trip

    !ach plane can be assigned to 5ero or more trips #but 17 at the same time;$

    !ach plane is of one and only one type of plane

    heir does not have to be a plane of a particular plane type in the fleet

    here can be more than one plane of a particular plane type in the fleet

    !ach type of plane can hold up to n passengers

    !ach type of plane can hold up to n tons of cargo

    !ach type of plane can hold up to m cubic feet of cargo

    !ach type of plane can fly up to n miles on one leg of a trip !ach type of plane re(uires a crew with a specific set of functional re(uirements

    #functional re(uirements are things li)e Vload masterP, Vinstrument only pilotP, W$

    !ach type of re(uirements can be specified 5ero or more times for each type of

    plane

    / single crew member can fulfill 5ero or more functions

  • 7/26/2019 DATABASE Answers to Review Questions

    45/46

    / job function has a per mile rate and an hourly rate #the rate charged is

    determined if the function is re(uired by law or by the customer$.

    / customer may re(uire 5ero or more additional job functions #possibly new crew

    members, possibly upgraded crew members$.

    !ach job function has one or more tests that are re(uired to be ta)en and passed at

    regular and irregular intervals to ensure regulatory compliance / single test may be ta)en by the same employee 5ero or more times

    / single employee can ta)e 5ero or more different tests

    / single employee can ta)e the same test 5ero or more times

    / log of all tests ta)en by the employee while at the company and just prior to the

    company will be )ept in the database

    / single employee can fill out 5ero or one expense report per trip

    / single employee can fill out 5ero or more expense reports over time

    /n expense report can contain one or more expense items

    /n expense item can only be in one and only one expense report

    !ach expense item has a cost and a date !ach expense item is associated with one and only one expense type #food, hotel,

    local transportation, W$

    !ach expense type can be associate with 5ero or more expense items

    17!S*7n the design I ignored the certificates and ratings and instead reduced the ability toperform a function #li)e flying in bad weather conditions$ to the tests that one must passto get the certificates. he assumption is that the passing of the tests confers thecertificate #and )eeping the tests current$.ests include actually written, oral, flight, and medical tests as well as re(uired re-certification trainingGclasses #which I suspect involve a test at the end$.I did not hoo) up the address table everywhere that it is necessary because it would crossa lot of lines and ma)e the diagram even harder to understand.I should have probably come up with a person table that contains first:name, last:name,middle:initial, phone:number, and home:address and then had the customer, passenger,and employee tables reference that table. 7nce again doing so ma)es the diagram moreconfusing. #&ut it would capture the fact that a customer or employee can be apassenger.$It probably ma)es sense to have a total:cost column in the rips table, however, thisvalue can be calculated from the values in the ripLegs, 6laneypes, 0unction,!xpense"eport, and Special3harges tables/ lot of the verification of this database will have to be done using application ordatabase code. #for example verifying that a plane is not scheduled for a trip with a legthat is longer than itPs flying range$.3an a pilot also be the flight attendant 3an the co-pilot be the flight attendant heexample does claim that a pilot can also be the load master so it is possible. IPve fixedthe pilotGco-pilot issue #as well as the need for more than one flight attendant$ by having a

  • 7/26/2019 DATABASE Answers to Review Questions

    46/46

    VnumberP column in the 3rew"e(uirements table to indicate if you need two separateemployees with the same s)ills.IPm not sure how you would calculate the rate charged a customer if they re(uired a pilotupgrade #the law re(uires one rate, the hourly rate is normally used however in the caseof a customer specified function$.