You are on page 1of 46

Answers to Review Questions

1. Name and discuss the different levels of data abstraction as defined by ANSI/SPARC. Conceptual Located at the abstraction apex, the conceptual model represents a global view of the data. It forms the basis of the conceptual schema, which provides a relatively easily understood bird's-eye view of the data environment. Since the conceptual model focuses on the main data objects and avoids detail, it exhibits both software and hardware independence. 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 the conceptual model's characteristics and constraints to those of the selected hierarchical, networ), or relational %&'S. herefore, although it is still hardware-independent, it is software-dependent. External he external model represents the applications programmer's view of the data environment. Its use re(uires that the modeler subdivide a universal set of re(uirements and 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 thus represented by an external model that includes that unit's entities, the relationships between 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.

Physical he physical model operates at the lowest level of abstraction. It describes the way data will be saved on storage media such as dis)s or tapes. &ecause the physical model re(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-and software-dependent. #See section ,.-...$ . !hat are the main buildin" modules of the #ntity Relationshi$ model% &iscuss each one. he !-" model contains the following components* Entities are used to represent real world objects such as professor, class, student, etc. /ctually, the !-" model uses entity sets, 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 word entity actually refers to entity set. !ntity types include weak and composite entities. 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#N&#N' cannot e(ist without #-P./0##.1 . '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 the entities it connects. 0inally, entities may be classified as supertypes and subtypes. In effect, we can create a generali5ation hierarchy to represent entities that share common characteristics. 0or example, all !'6L78!! entities share attributes such as 1/'!, /%%"!SS, 97'!:6971!, etc. 9owever, special employees such as pilots have attributes, such as 0L : I'!, not shared by other employees. hus 6IL7 becomes a subtype of the supertype !'6L78!!. #See the detailed discussion in section ,.,.4-;$ Attributes are the characteristics that define an entity. 0or example, the attributes 1/'!, /%%"!SS, 6971!, and '/<7" are some of the characteristics of the S +%!1 . Some attributes perform the crucial role of identifying each entity uni(uely. Such attributes form the entity's primary )ey.

/ttributes are classified as simple or composite. / composite attribute is one that can be subdivided to yield additional attributes. 0or example, a phone number can be subdivided into 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 only one gender and one birth date. 'ultivalued attributes can have many values* / person can have more than one college degree, and a household may have more than one phone. Relationships are associations between entities. hus the relationship between the entities 6"70!SS7" and 3L/SS is teaches, i.e., a 6"70!SS7" teaches a 3L/SS. "elationships are classified by their degree. +nary relationships are those whose entities form relationships with themselves, thus producing so-called recursive relationships. 0or example, a 37+"S! may be a prerequisite to a 37+"S!. &inary relationships, i.e., relationships between two different entities, are most common and 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, a 371 "I&+ 7" contributes to a 0+1%, and a "!3I6I!1 receives funding from that 0+1%. 9igher-order relationships than ternary are uncommon in !-" modeling. "elationships are also classified as 4*4, 4*', and '*1. he term connectivity is used to describe such classifications. he participation of relationships may also be classified as optional 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 '*1 relationships into sets of 4*' relationships. he composite entity's primary )ey consists of the combination of primary )eys from the entities it connects. 0or a detailed review of the role played by composite entities, refer to the second discussion focus (uestion # 5ow are -,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 different groups of data users view the data from a different perspective. his perspective is based on a host of factors* 3ler)s or sales personnel have different data needs from the purchasing manager and the company president. /pplication programmers and developers have yet different views. o use the analogy presented in the boo), different groups of information users and producers tend to reflect the =blind men and the elephant= allegory* he one who felt the elephant's tail had (uite a different view of the elephant from the one who felt its trun). 2hat we need is the ability to see the whole

elephant. Similarly, a house is not a random collection of rooms> if we intend to build a house, we should first have an over- all view provided by its blueprint. Similarly, a sound data 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 understand the complexities of the real-world environment. Such understanding facilitates communication between the various data users and producers. he use of the blueprint analogy is appropriate because, li)e any building blueprint, the database blueprint based on a data model enables us to see what data are needed, how the data are to be stored, by whom the data are to be used, and how the data are related. / good data model ultimately enables us to understand how an organi5ation functions, thus enabling us to communicate the 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

1 A owns

; "ets N C 1 yields &

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

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

#(ternal model <

1 A owns

; "ets N C & yields C

=. 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%1 /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 or lesser extent, these data models are implemented through a hierarchical, networ), or relational %&'S. #See 0igure ,.4 in the text.$ he higher the level of abstraction, the less need for the often difficult-to-understand physical 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. In fact, 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 conceptual data model. he conceptual model, being located 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$hically1 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 is indicated through the use of a double-line rectangle. / composite entity is identified through 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.

c. A relationshi$ / relationship is indicated by a diamond-shaped symbol located between the entities whose relationship is being described. he diamond contains the relationship description, written in lowercase letters. he relationship description is usually an active verb such as teaches, flies, writes, etc. 9owever, the relationship may warrant a more passive description to improve the !-" diagram's readability for humans* 6IL7 is an !'6L78!!, I1B7I3!:LI1! is contained within I1B7I3!, etc. "elationships are implemented through the use of foreign )eys. "eview the example given in discussion (uestion -. #5ow are -,N relationshi$s handled in the develo$ment of an #)R dia"ram%$ /lso review the many models and their tables presented in the chapter. ?. 'he 5udson #n"ineerin" :rou$ +5#:1 has contacted you to create a conce$tual model whose a$$lication will meet the e($ected database re@uirements for its trainin" $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 4A trainees $er class. 5#: offers five 7advanced technolo"y7 courses* each of which may "enerate several classes. If a class has fewer than 1A 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, an I1S "+3 7" teaches up to two 3L/SSes, and a "/I1!! may enroll in up to two 3L/SSes. / trainee can ta)e more than one class, and each class contains many #4C or more$ 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!! and 3L/SS.$ / class is taught by only one instructor, but an instructor can teach up to two classes. herefore, there is a 4*' relationship between I1S "+3 7" and 3L/SS. 0inally, a 37+"S! may generate more than one 3L/SS, while each 3L/SS is based on one 37+"S!, so there is a 4*' relationship between 37+"S! and 3L/SS. hese relationships are all reflected in the following !-" diagram. 1ote the optional and

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.=$ /n I1S "+3 7" may not be teaching any 3L/SSes, doing research instead, but each 3L/SS must have an I1S "+3 7". If not enough people sign up for a 3L/SS, a 37+"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#:

1 INS'RCC'/R +A* 1 teaches +1*11 C.ASS +1*11 "enerates +A*N1 +1A*4A1 +1*11 1 C/CRS# 1 +1*11 #NR/.. 'RAIN## +A* 1

B. &iscuss the difference between a com$osite 2ey and a com$osite attribute. 5ow would each be indicated in an #)R dia"ram% / composite )ey is one that consists of more than one attribute. / composite attribute is one 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 indicated in the !-" diagram by the fact that more than one attribute name is underlined to indicate its participation in the primary )ey. here is no !-" convention that enables us to indicate that an attribute is a composite attribute.

1A. !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 these components in the same entity. !xamples*

3/" color is decomposed into 7637L7", "I'37L7", 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's components and lin) this new entity to the entity in which the multi-valued attributes occurred originally. his second option is especially desirable when the number of outcomes in the multivalued attribute is, for all practical purposes, unlimited. 0or example, employees classified as =technical= may have certifications in many different areas 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 very reluctant 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 <ulian dates to subtract the birth date from the current date and dividing the resulting number of days by ,DE. In other words, the attribute !'6:/@! is computed by !'6:/@! F #!'6:%7& - %/ !#$$G,DE Similarly, a sales cler)'s total gross pay may be computed by adding a computed sales commission to base pay. 0or instance, if the sales cler)'s commission is 4H, the gross pay may be computed by !'6:@"7SS6/8 F I1B:S/L!SI4.C4 J !'6:&/S!6/8 7r the invoice line item amount may be calculated by LI1!: 7 /L F LI1!:+1I SI6"7%:6"I3! he problem with not storing derived attributes is that large databases tend to yield very slow (ueries when the derived attribute values are computed during the (uery. 0or example, if you need to get line item amounts for each product sold during a pass across ten million invoice line records, you will discover that the results are slow in coming; It is much less noticeable to the end-user when the re(uired values are computed at the time of their generation and then to store the results in the table> the same (uery will execute much faster in this scenario. 9ere is a typical example of the trade-offs that are often re(uired in the real world. %epending on the information re(uirements, the number of occurrences in the (ueried tables, and the fre(uency with which various sales revenue (ueries are executed, it may even be useful to store line totals in the invoice line table AND to store the line totals in the invoice table;

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. he diamond 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 the kind of relationship that exists between the entities. 1ote the illustrations in 0igure K,.4-.

9i"ure Q4.1

#(am$les of Relationshi$s ;etween #ntities

1 PR/9#SS/R teaches

C.ASS

1 CCS'/-#R "enerates

INE/IC#

E#N&/R delivers

N PR/&CC'

1 E#N&/R

&#.IE#R0

1 INE#N'/R0

1 E#N&/R ma2es

&#.IE#R0

increases by

1 INE#N'/R0

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 entity with 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.

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.1 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, while the box represents an entity. hus the composite entity indicates that it translates a '*1 relationship into two 4*' relationships through an entity. he label =bridge entity= is based 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 the primary )ey attributes of each of the entities that are connected by it. he composite entity is an important component of the !-" model because relational database models should 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 times and, 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 entity named L7@ whose attributes are defined by the end-user information re(uirements. In this 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 other words, the composite entity must contain at least the primary )eys of the entities connected by it. +sually, this combination of foreign )eys is designated to be the composite entity's primary )ey. 9owever, depending on (uery re(uirements, the composite entity's primary )ey may be an entirely new attribute, thus producing a table containing two candidate )eys* the designated primary )ey and the combination of foreign )eys that could have served as the primary )ey. 3omposite entities may be named to reflect their component entities. 0or example, an employee may have several insurance policies #life, dental, accident, health, etc.$, and each insurance policy may be held by many employees. his '*1 relationship is converted to a set of two 4*' relationships, by creating a composite entity named !'6:I1S. he !'6:I1S entity must contain at least the primary )ey components of each of the two entities connected by it. 9ow many additional attributes are )ept in the composite entity depends on the end-user information re(uirements.

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. A com$any o$erates four de$artments. /lthough the company operates four departments now, it may later decide to combine operations or to expand them. 3learly, the company operates at least one department. b. #ach de$artment in $art +a1 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 be involved in a given operation before a department can be formedL he answer to that (uestion depends on company policy, which dictates the appropriate business rule. hus the 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 not claimed by an employee, and because we have chosen to make the DEPENDENT s primary key a combination of the E!P"#$EE s primary key and the DEPENDENT s number, %!6!1%!1 is a wea) entity.

d. #ach em$loyee in $art +c1 may or may not have an em$loyment history. !ach employee may have an employment history. If a newly hired employee has no prior wor) experience, that employee will not have an employment history, so the !'6:9IS is optional to !'6L78!!. Since an employee may have wor)ed for more than one previous employer or may have wor)ed in several other departments prior to the current assignment, there is a 4*' relationship between !'6L78!! and !'6:9IS . 3learly, an employment history is associated with a specific employee and, because we have decided that the !'6:9IS ' primary )ey will be a combination of the !'6L78!!'s primary )ey and the !'6:9IS 's record number, the !'6:9IS is both a wea) and optional entity. In short, the !'6:9IS dependencies and primary )ey may be* !'6:9IS ##-PFNC-, 5IS'F.IN#, 9IS :8!/", 9IS :%!S3"I6 I71, .... etc.$ #2e have bold-faced the primary )ey components.$ 1ote again that the !'6:9IS is a wea) entity because of the designer s decision to create its primary )ey in this fashion.

1=. Csin" 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.

1 C/-PAN0 +1*61 o$erates

&#PAR'-#N' +1*11 +1*N1 em$loys

&#P#N&#N' +1*11 claims

1 +A*N1

+1*11 #-P./0## +A*N1 has +1*11 #-PF5IS'

1>. !hat three +often conflictin"1 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 concerning nulls, 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 information re(uirements or one that forms the basis for an implementation whose use progresses at a snail's pace has little practical use. 1?. ;riefly* but $recisely* e($lain the difference between sin"le)valued attributes and sim$le attributes. :ive an e(am$le of each. / single-valued attribute is one that can have only one value. 0or example, a person has only one first name and only one social security number. / simple attribute is one that cannot be decomposed into its component pieces. 0or example, a person's sex is classified 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. #In contrast, if a phone number includes the area code, it can be decomposed into the area code and the phone number itself. /nd a person's name may be decomposed into a first name, an initial, and a last name.$ Single-valued attributes are not necessarily simple. 0or example, an inventory code 926"I<-,4.E may refer to a classification scheme in which 92 indicates 9ard2are, 6" indicates 6rinter, I< indicates In)<et, and -,4.E indicates an inventory control number. herefore, 926"I<-,4.E may be decomposed into its component parts... even though it is single-valued. o facilitate product trac)ing, manufacturing serial codes must be single-valued, but they may not be simple. 0or instance, the product serial number 16ES-'-,44CM4E.,-4 might be decomposed this way* 1 F state F ennessee 6E F plant number E S- F shift '-, F machine -, 44 F month, i.e., 1ovember CM F day 4E.,-4 F time on a -.-hour cloc), i.e., 4E*.,*-4, or ,*., p.m. plus -4 seconds

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 professional certifications such as a 3ertified 6ublic /ccounting certificate or a 3ertified %ata 6rocessing 3ertificate. here are basically three ways to handle multi-valued attributes, and two of those three ways are bad*

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 nulls for those who had minimal educational attainments. +sing the preceding example, a person with only a high school diploma would generate nulls for the --year college associate degree, the four-year college degree, the 'aster's degree, the %octoral degree, and for each of the professional certifications. In addition, how many professional certification attributes should be maintainedL If you store two professional certification attributes, you will generate a null for someone with only one professional certification and you'd generate two nulls for all persons without professional certifications. /nd suppose you have a person with five professional certificationsL 2ould you create additional attributes, thus creating many more nulls in the table, or would you simply ignore the additional professional certifications, thereby losing informationL -. he educational attainments may be )ept as a single, variable-length string or character field. his solution is undesirable because it becomes difficult to (uery the table. 0or example, even a simple (uestion such as =how many employees have fouryear college degreesL= re(uires string partitioning that is time-consuming at best. 7f course, if there is no need to ever group employees by education, the variable-length string might be acceptable from a design point of view. 9owever, as database designers 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 a composite 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 within the !'6L78!! table to accommodate people with multiple certifications. In short, we eliminate the generation of nulls. In addition, we gain information flexibility because we can also store the details #date earned, place earned, etc.$ for each of the educational attainments. he #simplified$ structures might loo) li)e those in 0igure K,.4M /-3.

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


&atabase name, C54FQC#S'I/NS
'able name, #-P./0## 'able name, #-PF#&CC 'able name, #&CCA'I/N

9i"ure Q4.1B & 'he Relational Schema for the C54FQC#S'I/NS

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

9i"ure Q4.1B# 'he #R& for the C54FQC#S'I/NS &atabase


1 #-P. /0## +1* N 1 +1* 11 #-PF#& CC

1 #& CCA'I/N

+1 * 11

+A*N1

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

1 A;C +a*b1

H A;F&#

I &#9

+e*f1

+"*h1

+i* G1

+2* l1

(((((

- +c*d1 A;C

1 yyyyy +m*n1

JK. +o*$1

A. !rite the $ro$er cardinalities for +e*f1FFF#C,1$FFF +"*h1FFF#4,4$FFF FF4,4FFF +i*G1FFF#4,4$FFF

+a*b1FFF #C,1$FFF +2*l1FFF#C,1$FF

+c*d1FFF#4,4$FFF +o*$1

+m*n1 FFC,1FFF

1. !rite the $ro$er connectivities for

!FF4FF

HFF'FFF 0FF'FFF IFF4FFF

. !hat two attributes must be contained in the com$osite entity% Cse $ro$er terminolo"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 )ey that references the entities for which the composite entity serves as a bridge. 4. &escribe precisely the com$osition of the wea2 entity3s $rimary 2ey. Cse $ro$er terminolo"y in your answer. / wea) entity's primary )ey must be a composite )ey that includes the primary )ey of the entity 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. A 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.

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

&IEISI/N

o$erates

&#PAR'-#N'

em$loys

mana"es

runs

#-P./0##

is assi"ned to

PR/J#C'

1. Cse the followin" business rules to write all a$$ro$riate connectivities in the #)R dia"ram, one a. A de$artment em$loys many em$loyees* but each em$loyee is em$loyed by de$artment.

he answers to (uestion 4 #all parts$ are included in the !-" diagram that accompanies 6roblem ,. b. Some em$loyees* 2nown as 7rovers*7 are not assi"ned to any de$artment. by one c. A division o$erates many de$artments* but each de$artment is o$erated 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.

". /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 relationships between %!6/" '!1 and !'6L78!!.

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

1 &IEISI/N 1 +1*11 +1*N1 o$erates

&#PAR'-#N' +1*11 +1*N1 1

1 +1*11

em$loys 1 runs +A*11 +A*11 1

mana"es

#-P./0## +A*N1 1 +1*11 ASSI:N +1*11 +1*N1 1 PR/J#C'

+A*11

&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 important when the design is implemented. 0or example* he /SSI@1 entity is shown to be optional to the 6"7<!3 . his decision ma)es sense from a practical perspective, because it lets you create a new project record without having to create a new assignment record. #If a new project is started, there will not yet be any assignments.$

he relationship expressed by Q%!6/" '!1 employs !'6L78!!R is shown as mandatory on the !'6L78!! side. his means that a %!6/" '!1 must have 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 not acceptable, 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 a department. 1ote also the implications of the 4*4 Q!'6L78!! manages %!6/" '!1 R relationship. he flip side of this relationship is that Qeach %!6/" '!1 is managed by one !'6L78!!R. # his latter relationship is shown as mandatory in the !"%. hat is, each department must be managed by an employee;$ herefore, one of the !'6L78!! tablePs 6A values must appear as the 0A value in the %!6/" '!1 table. #;ecause this is a 1,1 relationshi$* the inde( $ro$erty of the #-PFNC- 9K in the &#PAR'-#N' table must be set to Luni@ue.M $ /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*4 relationships reflected in the Q!'6L78!! manages %!6/" '!1 R and Q!'6L78!! runs %ISISI71R are appropriate. hese 4*4 relationships avoid the data redundancies you would encounter if you duplicated employee data O such a names, phones, and e-mail addresses O in the %IBISI71 and %!6/" '!1 entities.

6. Convert the Chen model you have develo$ed in $roblems 1)4 to a CrowDs 9oot model. 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 important 3rowPs 0oot features to )eep in mind. If you have multiple relationships between two entities -- such as the Q!'6L78!! manages %!6/" '!1 R and Q%!6/" '!1 employs !'6L78!!R relationships O you must ma)e sure that each relationship has a designated primary entity. 0or example, the 4*4 relationship expressed by Q!'6L78!! manages %!6/" '!1 R re(uires that the !'678!! entity be designated as the primary #or QfirstR$ entity. If you use Bisio to create your 3rowPs 0oot !"%s, 0igures 6,..a and .b show how the 4*4 relationship is specified. If you use some other 3/S! tool, you will discover that it, too, is li)ely to re(uire similar relationship specifications.

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 entity specification provided plenty of room to expand the name to its proper noun specification. #/SSI@1 might be interpreted as a verb.$ he 3ompleted 3rowPs 0oot !"% for 6roblems 4-,

0igure 6,..

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

8. 'em$orary #m$loyment Cor$oration +'#C1 $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 candidates who 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.1 #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.1 '#C also has a list of companies that 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* +s1he 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 S#C)68 S#C)=A C.#RK PR:)E; PR:)CNN &;A)/R &;A)&; S0S)1 $escription Secretarial wor2* at least 68 words $er minute Secretarial wor2* at least =A words $er minute :eneral cler2in" wor2 Pro"rammer* Eisual ;asic Pro"rammer* CNN &atabase Administrator* /RAC.# &atabase Administrator* &; Systems Analyst* level 1

S0S) N!)N/E

Systems Analyst* level Networ2 administrator* Novell e($erience

'#C3s mana"ement wants to 2ee$ trac2 of the followin" entities, C/-PAN0 /P#NIN: QCA.I9ICA'I/N CAN&I&A'# J/;F5IS'/R0 P.AC#-#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

1 C/-PAN0 +A*N1 lists 1 1 +1*11 /P#NIN: +A*N1 +1*11 P.AC#-#N' +1*11 +1*11 +A*N1 +1*11 matches 1 QCA.I9ICA'I/N +A*N1 +1*N1 +1*11 CANFQCA. 1 +1*11 +1*N1 CAN&I&A'# +A*N1 has 1 creates +A*11 +1*11 5IS'/R0 1 1 1

o help the students understand the !-" diagram's components better, the following discussion is li)ely to be useful* !ach 37'6/18 may list one or more 76!1I1@s. &ecause we will maintain 37'6/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-dependent on 37'6/18, because there cannot be an opening unless it is listed by a company. &ecause we have decided to use the 37'6/18 primary )ey as a component of the 76!1I1@'s primary )ey, we have satisfied the conditions that will allow us to classify 76!1I1@ as a wea) entity. !ach job 3/1%I%/ ! may have many job 9IS 7"8 entries. &ut )eep in mind that a candidate may just have competed job training and, therefore, may not have had job experience #i.e., no job history$ yet. In short, 9IS 7"8 is optional to 3/1%I%/ !. 7n the other hand, a job candidate may have had many jobs #remember, !3 is a temp employer;$ and, therefore, would have many entries in 9IS 7"8. 0inally, 9IS 7"8 is clearly existence-dependent on 3/1%I%/ !> it is not possible to ma)e an entry in 9IS 7"8 without having a 3/1%I%/ ! to generate that history. 2e will use the 3/1%I%/ ! primary )ey as one of the components of the 9IS 7"8's primary )ey, thus allowing us to classify 9IS 7"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 candidate because 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 relationship between 3/1%I%/ ! and K+/LI0I3/ I71 is '*1. his relationship must be decomposed into two 4*' relationships with the help of a composite entity we will name 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 between K+/LI0I3/ I71 and 76!1I1@. 0or example, a job opening for a 3JJ programmer re(uires an applicant to have the 3JJ programming (ualification, but there may be many job openings for 3JJ programmers; 9owever, a (ualification does not re(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 listed opening 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/ I71 primary )ey as a component of the 76!1I1@'s #composite$ primary )ey. &ecause 76!1I1@ is existence-dependent on K+/LI0I3/ I71 and because it borrows the K+/LI0I3/ I71's primary )ey as component of its own primary )ey, 76!1I1@ is

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 many openings. # !3 supplies temporaries, rememberL$ 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 between 3/1%I%/ ! and 76!1I1@. &ecause there is not necessarily an opening for each candidate, 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 to 76!1I1@. 1ote the migration of the optional symbols in the !-" diagram. #8ou may wonder 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 the 76!1I1@'s relationship to 37'6/18;$ /lso, remind the students that, although an opening 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 9IS 7"8 for every 6L/3!'!1 entry, but not all 9IS 7"8 entries will have a matching placement entry. In other words, all 6L/3!'!1 entries will have a matching 9IS 7"8 entry, but 6L/3!'!1 is optional to 9IS 7"8 because a position may have been filled by the candidate rather than through the !3 services;

=. 'he Jonesbur"h County ;as2etball Conference +JC;C1 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.1 #ach team $lays two "ames +home and visitor1 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

+1*11 :A-#

+1*11

1 CI'0 +1*11 s$onsors

1 +1*11

+ *N1 '#A1

+ *N1

1 has

P.A0#R +1*11

+1*41 uses

+B*1 1

+1*11

C/AC5

o help the students understand the !-" diagram's components better, note the following relationships* he main components are !/' and @/'!.

!ach team plays each other team at least twice. 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 '*1 relationship with @/'!. he relationship between !/' and @/'! becomes clearer if we list some attributes for each of these entities* @/'! entity @/'!:1+' @/'!:%/ ! @/'!:97'!: !/' @/'!:BISI : !/' @/'!:97'!:67I1 S @/'!* @/'!:BISI :67I1 S !/' entity !/':1+' !/':1/'! !/':3I 8 1ote* !/':1+' appears at least twice in a 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 are delivered almost immediately. !hen an order comes in* it is chec2ed to determine whether the re@uested item+s1 is +are1 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",

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 >

1 &#PAR'-#N' +1*N1 $laces +1*11 /R&#R +1*N1 +1*11 SCPP.I#R +1*N1 +1*11 I'#-FSCP +1*11 +1*N1 I'#+1*11 +1*N1

/R&FI'#-

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 INE/IC# 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 INE/IC# is written for a sin"le CCS'/-#R. 5owever* each customer can have many invoices.

An INE/IC# may include many detail lines +.IN#1 which describe the $roducts bou"ht by the customer. 'he $roduct information is stored in a PR/&CC' entity. 'he $roduct3s vendor information is found in a E#N&/R entity. Note, 'he #R& must reflect business rules that you reason1 free to define. -a2e sure that your #R& conditions you re@uire. 9inally* ma2e sure that you attributes that would $ermit the model to be im$lemented. are +within reflects the include the successfully

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

1 CCS'/-#R +1*N1 "enerates +1*11 INE/IC# +1*11 writes 1 +1*N1 SA.#SR#P +1*N1 +1*11 E#N&/R +1*11 +1*N1
S5IP-#N'

INEF.IN#

+1*11

1 +1*N1

+1*11 +1*N1 PR/&CC'

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


1 E#N&/R +A*N1 shi$s 1 CCS'/-#R +1*N1 "enerates +1*11 INE/IC# +1*11 writes 1 +1*N1 SA.#SR#P +1*N1 1 contains +1*11 INEF.IN# +1*11 is in +A*N1 1 +1*11 /R&#R +1*11 shows in +1*N1 PR/&CC' 1 -

B. :iven the followin" brief summary of business rules for the R/;C/R 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.

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

1 #N'R## +1*N1 is $art of 1 +1*11 &INN#R +1*N1 +1*N1 +1*11 INEI'A'I/N

A''#N&ANC#

+1*11 +1*11

1 :C#S' +A*N1 +1*N1

+1*11

1A. Csin" the CrowDs 9oot methodolo"y* create an #R& that can be im$lemented for a medical clinic* usin" at least the 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 is entered 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.

If the bill is $aid by an insurance com$any* the deductible is submitted to the $atient for $ayment.

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


PA'I#N' +A*11 +1*N1 $ays PA0F;I.. +1*11 +1*N1 +1*11 +1*N1 +1*11 submits 1 +1*11 1 1 1 1 +1*11 1 +1*N1 +1*11 1 u$dates +1*11 1 1 APP/IN'-#N'

+1*11 -

1 &/C'/R +1*N1 +1*N1 ma2es

1 1

+A*11 +1*11 EISI' +1*11 $roduces +1*11 ;I.. +1*N1 +1*11

+1*11

1 creates +1*N1 +1*11 C.AI+1*11 yields 1 +1*N1 +1*-1 INSCRANC# 1 1 -

has

1 +1*11 ma2es +1*11 +1*11 1

PA0-#N' 1 1

C5:F.IN# +1*11 +1*N1 CA'#:/R0

PA'FPA0

INSFPA0 +A*11 sends

+1*N1

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 to travel 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 Slow1 Center. Csin" 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 authoriPed faculty member. !hen the faculty member arrives to $ic2 u$ the vehicle* +s1he must si"n a chec2)out form to lo" the vehicle out and to $ic2 u$ a tri$ com$letion form. +'he '9;S em$loyee who releases the vehicle for use also si"ns the chec2)out form.1 '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. C$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* minibus1 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 authoriPation may release the vehicle bac2 into service.1 As soon as the lo" form has been initiated* the lo" form3s number is transferred to a maintenance detail formQ 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

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 maintenanceQ 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) labeledO1 #)R dia"ram. Cse the Chen methodolo"y to indicate entities* relationshi$s* connectivities* and cardinalities.

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


1 enters +1*11 +A*N1 ./: +1*11 1 1 +1*N1 E#5IC.# +1*11 indicates 1 +1*N1 1 '0P# 1 +1*N1 defines +1*11 C5AR:# +1*11 +1*11 $ays +1*11 is in 1 "enerates +1*11 +1*11 1 1 +1*N1
is found in references

1 yields +1*N1

./:F.IN# +1*11 +1*11 si"ns 1 +A*N1 +1*N1


-#C5ANIC

uses +A*11

1 PAR' +1*N1 +1*N1

+1*11 1

writes

re@uires 1 ma2es +1*N1 +1*11 1


&#PAR'-#N'

+1*N1 -

- +1*11
SI:NF/C'

+1*11 1

R#S#REA'I/N

ma2es +1*11

matches +1*N1

+1*11

+A*11 yields +1*11

+A*N1

+1*N1 em$loys

+A*11
#-P./0##

re@uires +1*11

1 +A*N1

+1*11 9ACC.'0

+1*11

1 +A*11 is an +A*N1 initials

C5#CKF/C'

0igure 6,.44's !-" diagram has been rendered at the implementation level. hat is, we have converted all composite entity relationships by naming them, thus eliminating the need to show the diamonds within the boxes. he following conditions are reflected within the !-" diagram* &ecause a vehicle can re(uire maintenance many times and each maintenance procedure 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 maintenance department, 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 maintenance detail 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 use many 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 be signed out -E times. #1ot the same one, of course.... but each time a hose clamp is used, 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 a mechanic 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 a mechanic 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 a reservation is made, it must have been made by a department, so %!6/" '!1 is 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 iny 3ollege vehicles, so 39!3A:7+ is optional to 0/3+L 8. !ach chec)-out generates a charge and each charge is related to one chec)-out.

!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 at the #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, note the similarities between the !-" segments shown in 0igure 6,.4C/.

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

1 INE/IC# +1*N1 1 +1*11


INEF.IN#

1 ./: +1*N1 1 +1*11


./:F.IN#

1 -#C5ANIC +1*N1 1 +1*11


SI:NF/C'

1 -#C5ANIC +1*N1 1 +1*11


-#C5FQCA.

+1*11 +1*N1 PR/&CC'

+1*11 +1*N1 PAR'

+1*11 +1*N1 PAR'

+1*11 +1*N1
QCA.I9ICA'I/N

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 by eliminating the 4*4 relationships between "!S!"B/ I71, 39!3A:7+ and 39/"@!. he combined entity, named "!S:39A7+ , would then yield a table with these attributes* Attribute name "!S:1+' "!S:%/ ! !'6:1+' %!6 :37%! 86!:37%! "!S:6I3A:+6 B!9:1+' 0/3:1+' "!S:"! +"1 "!S:'IL!S "!S:37'6L/I1 S "!S:37S "!S:"!0 "!S:&ILL Sam$le values -4,,. 4CG4EGMD .,EE 3IS S. 44GSGMD 09@-4-,. -E4. 44GNGMD -NE.. %ashboard rattles at low rpm, rough idling TN.EC BIS/ TNE.D-

&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& R based on the CrowDs 9oot model R 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 S 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 maintain careful control of its $arts +oil* wi$ers* oil filters* air filters1 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-.

9i"ure P4.1

'he #R& for Problem 1

1 CAR 1 +1*N1 +1*11


CCSFCAR

+1*11 +1*N1 CCS'/-#R

1 "enerates +A*N1

INE/IC# +1*11 +1*N1 +1*11


INEF.IN#

1 E#N&/R +A*N1 shi$s +1*11 /R&#R +1*N1 +1*11

+1*11 +A*N1 PAR' +A*N1 +1*11


/R&F.IN#

14. /.

Cse 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 #L I only put this in here because I suspect that the company will want to )now how many people from 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 #LL he description does not indicate more than two categories, model and decals, but a better design would include 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 part number etc wor) better if a product has a single scale and then are grouped by product group O I also tossed around the idea of having something called an VitemP that was a product at a particular scale but it degenerated into a product that is part of 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, and VshippedP$ /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, WL #17 !* a better design would have a payment voucher abstraction so

the database could handle Vstore creditP for returned items, gift cards, and coupons$ / 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

;. Please see the additional files named 4)14."if* 4)14.vsd* and 4)141Fraster."if located on the C& and website. 16. A. Cse the followin" descri$tion of the o$erations of the RCFCharter Com$any to com$lete this e(ercise. 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

/ 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 to perform a function #li)e flying in bad weather conditions$ to the tests that one must pass to get the certificates. he assumption is that the passing of the tests confers the certificate #and )eeping the tests current$. ests include actually written, oral, flight, and medical tests as well as re(uired recertification 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 cross a 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 more confusing. #&ut it would capture the fact that a customer or employee can be a passenger.$ It probably ma)es sense to have a total:cost column in the rips table, however, this value can be calculated from the values in the ripLegs, 6lane ypes, 0unction, !xpense"eport, and Special3harges tables / lot of the verification of this database will have to be done using application or database code. #for example verifying that a plane is not scheduled for a trip with a leg that is longer than itPs flying range$. 3an a pilot also be the flight attendantL 3an the co-pilot be the flight attendantL he example does claim that a pilot can also be the load master so it is possible. IPve fixed the pilotGco-pilot issue #as well as the need for more than one flight attendant$ by having a

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

You might also like