thomas m connolly & carolyn e begg : db questions

Upload: pareshbapna

Post on 03-Jun-2018

248 views

Category:

Documents


3 download

TRANSCRIPT

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    1/82

    DATABASE

    THOMAS M CONNOLLY & CAROLYN E BEGG

    SOLUTIONS TO REVIEW QUESTIONS

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    2/82

    Database Solutions (2ndEdition)

    Chapter 1 Introduction- Review questions

    1.1 List four examples of database systems other than those listed in Section 1.1.

    Some examples could be:

    A system that maintains component part details for a car manufacturer;

    An advertising company eeping details of all clients and adverts placed !ith them;

    A training company eeping course information and participants" details;

    An organi#ation maintaining all sales order information$

    1. !iscuss the meanin" of each of the followin" terms#

    $a% data

    %or end users& this constitutes all the different values connected !ith the various

    ob'ectsentities that are of concern to them$

    $b% database

    A shared collection of logically related data (and a description of this data)& designed to meet

    the information needs of an organi#ation$

    $c% database mana"ement system

    A soft!are system that: enables users to define& create& and maintain the database and

    provides controlled access to this database$

    $d% application pro"ram

    A computer program that interacts !ith the database by issuing an appropriate reuest

    (typically an S*+ statement) to the D,-S$

    $e% data independence

    .his is essentially the separation of underlying file structures from the programs that operateon them& also called program/data independence$

    2

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    3/82

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    4/82

    Database Solutions (2ndEdition)

    9n the mid/s& as applications became more complex and potentially could be deployed to

    hundreds or thousands of end/users& the client side of this architecture gave rise to t!o

    problems:

    A 6fat" client& reuiring considerable resources on the client"s computer to run effectively

    (resources include dis space&

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    5/82

    Database Solutions (2ndEdition)

    1. !escribe the functions that should be provided by a modern full-scale multi-user

    !()S.

    Data Storage&

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    6/82

    Database Solutions (2ndEdition)

    Chapter +he Relational )odel - Review questions

    .1 !iscuss each of the followin" concepts in the context of the relational data model#

    $a% relation

    A table !ith columns and ro!s$

    $b% attribute

    A named column of a relation$

    $c% domain

    .he set of allo!able values for one or more attributes$

    $d% tuple

    A record of a relation$

    $e% relational database.

    A collection of normali#ed tables$

    . !iscuss the properties of a relational table.

    A relational table has the follo!ing properties:

    .he table has a name that is distinct from all other tables in the database$

    Each cell of the table contains exactly one value$ (%or example& it !ould be !rong to store

    several telephone numbers for a single branch in a single cell$ 9n other !ords& tables don"t

    contain repeating groups of data$ A relational table that satisfies this property is said to be

    normali#edor in first normal form$)

    Each column has a distinct name$

    .he values of a column are all from the same domain$

    .he order of columns has no significance$ 9n other !ords& provided a column name is moved

    along !ith the column values& !e can interchange columns$

    Each record is distinct; there are no duplicate records$

    @

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    7/82

    Database Solutions (2ndEdition)

    .he order of records has no significance& theoretically$

    .& !iscuss the differences between the candidate 2eys and the primary 2ey of a

    table. 6xplain what is meant by a forei"n 2ey. 7ow do forei"n 2eys of tables relate

    to candidate 2eys3 8ive examples to illustrate your answer.

    .he primary ey is the candidate ey that is selected to identify tuples uniuely !ithin a

    relation$ A foreign ey is an attribute or set of attributes !ithin one relation that matches the

    candidate ey of some (possibly the same) relation$

    .' 9hat does a null represent3

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    8/82

    Database Solutions (2ndEdition)

    Chapter & S0L and 0(6 - Review questions

    &.1 9hat are the two ma4or components of S0L and what function do they serve3

    A data definition language (DD+) for defining the database structure$

    A data manipulation language (D-+) for retrieving and updating data$

    &. 6xplain the function of each of the clauses in the SELECT statement. 9hat

    restrictions are imposed on these clauses3

    FROM specifies the table or tables to be used;WHERE filters the ro!s sub'ect to some condition;

    GROUP BY forms groups of ro!s !ith the same column value;

    HAVING filters the groups sub'ect to some condition;

    SELECT specifies !hich columns are to appear in the output;

    ORDER BY specifies the order of the output$

    &.& 9hat restrictions apply to the use of the a""re"ate functions within the SELECT

    statement3 7ow do nulls affect the a""re"ate functions3

    An aggregate function can be used only in the SE+E4. list and in the 3A09BC clause$

    Apart from 4>=B.()& each function eliminates nulls first and operates only on the remaining

    non/null values$ 4>=B.() counts all the ro!s of a table& regardless of !hether nulls or

    duplicate values occur$

    &.' 6xplain how the GROUP BY clause wor2s. 9hat is the difference between the

    WHEREand HAVINGclauses3

    S*+ first applies the ?3E

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    9/82

    Database Solutions (2ndEdition)

    &.* 9hat is the difference between a subquery and a 4oin3 :nder what circumstances

    would you not be able to use a subquery3

    ?ith a subuery& the columns specified in the SE+E4. list are restricted to one table$ .hus&

    cannot use a subuery if the SE+E4. list contains columns from more than one table$

    &. 9hat is 0(6 and what is the relationship between 0(6 and S0L3

    *,E is an alternative& graphical/based& 6point/and/clic" !ay of uerying the database& !hich is

    particularly suited for ueries that are not too complex& and can be expressed in terms of a fe!

    tables$ *,E has acuired the reputation of being one of the easiest !ays for non/technical

    users to obtain information from the database$

    *,E ueries are converted into their euivalent S*+ statements before transmission to the

    D,-S server$

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    10/82

    Database Solutions (2ndEdition)

    Chapter ' !atabase Systems !evelopment Lifecycle - Review questions

    '.1 !escribe what is meant by the term ;software crisis

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    11/82

    Database Solutions (2ndEdition)

    !atabase plannin" is the management activities that allo! the stages of the database system

    development lifecycle to be reali#ed as efficiently and effectively as possible$

    System definition involves identifying the scope and boundaries of the database systemincluding its ma'or user vie!s$ A user vie!can represent a 'ob role or business application area$

    Requirements collection and analysis is the process of collecting and analy#ing information

    about the company that is to be supported by the database system& and using this information

    to identify the reuirements for the ne! system$

    .here are three approaches to dealing !ith multiple user vie!s& namely the centrali#ed

    approach& the vie! integration approach& and a combination of both$ .he centrali>ed approach

    involves collating the users" reuirements for different user vie!s into a single list of

    reuirements$ A data model representing all the user vie!s is created during the database

    design stage$ .he view inte"ration approachinvolves leaving the users" reuirements for each

    user vie! as separate lists of reuirements$ Data models representing each user vie! are

    created and then merged at a later stage of database design$

    !atabase desi"n is the process of creating a design that !ill support the company"s mission

    statement and mission ob'ectives for the reuired database$ .his stage includes the logical and

    physical design of the database$

    .he aim of !()S selection is to select a system that meets the current and future

    reuirements of the company& balanced against costs that include the purchase of the D,-S

    product and any additional soft!arehard!are& and the costs associated !ith changeover and

    training$

    ?pplication desi"ninvolves designing the user interface and the application programs that use

    and process the database$ .his stage involves t!o main activities: transaction design and user

    interface design$

    ,rototypin" involves building a !oring model of the database system& !hich allo!s the

    designers or users to visuali#e and evaluate the system$

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    12/82

    Database Solutions (2ndEdition)

    Implementationis the physical reali#ation of the database and application designs$

    !ata conversion and loadin" involves transferring any existing data into the ne! database andconverting any existing applications to run on the ne! database$

    +estin"is the process of running the database system !ith the intent of finding errors$

    /perational maintenance is the process of monitoring and maintaining the system follo!ing

    installation$

    '.' !escribe the purpose of creatin" a mission statement and mission ob4ectives for the

    required database durin" the database plannin" sta"e.

    .he mission statement defines the ma'or aims of the database system& !hile each mission

    ob'ective identifies a particular tas that the database must support$

    '.* !iscuss what a user view represents when desi"nin" a database system.

    A user vie! defines !hat is reuired of a database system from the perspective of a particular

    'ob (such as -anager or Supervisor) or business application area (such as mareting& personnel&

    or stoc control)$

    '. Compare and contrast the centrali>ed approach and view inte"ration approach to

    mana"in" the desi"n of a database system with multiple user views.

    An important activity of the reuirements collection and analysis stage is deciding ho! to deal

    !ith the situation !here there is more than one user vie!$ .here are three approaches to

    dealing !ith multiple user vie!s:

    the centrali#ed approach&

    the vie! integration approach& and

    a combination of both approaches$

    2

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    13/82

    Database Solutions (2ndEdition)

    Centrali>ed approach

    ed approachinvolves collating the reuirements for different user vie!s into a

    single list of reuirements$ A data model representing all user vie!s is created in the database

    design stage$ A diagram representing the management of user vie!s to 5 using the centrali#ed

    approach is sho!n in %igure 7$7$ Cenerally& this approach is preferred !hen there is a significant

    overlap in reuirements for each user vie! and the database system is not overly complex$

    See =i"ure '.' .he centrali#ed approach to managing multiple user vie!s to 5$

    @iew inte"ration approach

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    14/82

    Database Solutions (2ndEdition)

    merged using the vie! integration approach to form the "lobal lo"ical data model representing

    all user vie!s$

    '. 6xplain why it is necessary to select the tar"et !()S before be"innin" the physicaldatabase desi"n phase.

    Database design is made up of t!o main phases called logical and physical design$ During logical

    database design& !e identify the important ob'ects that need to be represented in the database

    and the relationships bet!een these ob'ects$ During physical database design& !e decide ho!

    the logical design is to be physically implemented (as tables) in the target D,-S$ .herefore it is

    necessary to have selected the target D,-S before !e are able to proceed to physical

    database design$

    See %igure 7$ Stages of the database system development lifecycle$

    '.5 !iscuss the two main activities associated with application desi"n.

    .he database and application design stages are parallel activities of the database system

    development lifecycle$ 9n most cases& !e cannot complete the application design until the design

    of the database itself has taen place$ >n the other hand& the database exists to support the

    applications& and so there must be a flo! of information bet!een application design and

    database design$

    .he t!o main activities associated !ith the application design stage is the design of the user

    interface and the application programs that use and process the database$

    ?e must ensure that all the functionality stated in the reuirements specifications is present in

    the application design for the database system$ .his involves designing the interaction bet!een

    the user and the data& !hich !e call transaction design$ 9n addition to designing ho! the

    reuired functionality is to be achieved& !e have to design an appropriate user interfaceto the

    database system$

    '.A !escribe the potential benefits of developin" a prototype database system.

    .he purpose of developing a prototype database system is to allo! users to use the prototype to

    identify the features of the system that !or !ell& or are inadeuate& and if possible to suggest

    7

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    15/82

    Database Solutions (2ndEdition)

    improvements or even ne! features for the database system$ 9n this !ay& !e can greatly clarify

    the reuirements and evaluate the feasibility of a particular system design$ 1rototypes should

    have the ma'or advantage of being relatively inexpensive and uic to build$

    '.1B !iscuss the main activities associated with the implementation sta"e.

    .he database implementation is achieved using the Data Definition +anguage (DD+) of the

    selected D,-S or a graphical user interface (C=9)& !hich provides the same functionality !hile

    hiding the lo!/level DD+ statements$ .he DD+ statements are used to create the database

    structures and empty database files$ Any specified user vie!s are also implemented at this

    stage$

    .he application programs are implemented using the preferred third or fourth "eneration

    lan"ua"e $&8L or '8L%$ 1arts of these application programs are the database transactions&

    !hich !e implement using the Data -anipulation +anguage (D-+)of the target D,-S& possibly

    embedded !ithin a host programming language& such as 0isual ,asic (0,)& 0,$net& 1ython& Delphi&

    4& 4GG& 4H& Iava& 4>,>+& %ortran& Ada& or 1ascal$ ?e also implement the other components of

    the application design such as menu screens& data entry forms& and reports$ Again& the target

    D,-S may have its o!n fourth generation tools that allo! rapid development of applications

    through the provision of non/procedural uery languages& reports generators& forms generators&

    and application generators$

    Security and integrity controls for the application are also implemented$ Some of these controls

    are implemented using the DD+& but others may need to be defined outside the DD+ using& for

    example& the supplied D,-S utilities or operating system controls$

    '.11 !escribe the purpose of the data conversion and loadin" sta"e.

    .his stage is reuired only !hen a ne! database system is replacing an old system$ Bo!adays&

    it"s common for a D,-S to have a utility that loads existing files into the ne! database$ .he

    utility usually reuires the specification of the source file and the target database& and then

    automatically converts the data to the reuired format of the ne! database files$ ?here

    applicable& it may be possible for the developer to convert and use application programs from

    the old system for use by the ne! system$

    8

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    16/82

    Database Solutions (2ndEdition)

    '.1 6xplain the purpose of testin" the database system.

    ,efore going live& the ne!ly developed database system should be thoroughly tested$ .his is

    achieved using carefully planned test strategies and realistic data so that the entire testing

    process is methodically and rigorously carried out$ Bote that in our definition of testing !e have

    not used the commonly held vie! that testing is the process of demonstrating that faults are

    not present$ 9n fact& testing cannot sho! the absence of faults; it can sho! only that soft!are

    faults are present$ 9f testing is conducted successfully& it !ill uncover errors in the application

    programs and possibly the database structure$ As a secondary benefit& testing demonstrates

    that the database and the application programs appear to be !oring according to their

    specification and that performance reuirements appearto be satisfied$ 9n addition& metrics

    collected from the testing stage provides a measure of soft!are reliability and soft!are

    uality$

    As !ith database design& the users of the ne! system should be involved in the testing

    process$ .he ideal situation for system testing is to have a test database on a separate

    hard!are system& but often this is not available$ 9f real data is to be used& it is essential to

    have bacups taen in case of error$

    .esting should also cover usability of the database system$ 9deally& an evaluation should be

    conducted against a usability specification$ Examples of criteria that can be used to conduct the

    evaluation include (Sommerville& 2):

    +earnability / 3o! long does it tae a ne! user to become productive !ith the systemJ

    1erformance / 3o! !ell does the system response match the user"s !or practiceJ

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    17/82

    Database Solutions (2ndEdition)

    -aintaining and upgrading the database system (!hen reuired)$ Be! reuirements are

    incorporated into the database system through the preceding stages of the lifecycle$

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    18/82

    Database Solutions (2ndEdition)

    Chapter * !atabase ?dministration and Security - Review questions

    *.1 !efine the purpose and tas2s associated with data administration and database

    administration.

    Data administration is the management and control of the corporate data& including database

    planning& development and maintenance of standards& policies and procedures& and logical

    database design$

    F

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    19/82

    Database Solutions (2ndEdition)

    Database administration is the management and control of the physical reali#ation of the

    corporate database system& including physical database design and implementation& setting

    security and integrity controls& monitoring system performance& and reorgani#ing the database

    as necessary$

    *. Compare and contrast the main tas2s carried out by the !? and !(?.

    .he Data Administrator (DA)and Database Administrator (D,A)are responsible for managing

    and controlling the activities associated !ith the corporate data and the corporate database&

    respectively$ .he DA is more concerned !ith the early stages of the lifecycle& from planning

    through to logical database design$ 9n contrast& the D,A is more concerned !ith the later

    stages& from applicationphysical database design to operational maintenance$ Depending on the

    si#e and complexity of the organi#ation andor database system the DA and D,A can be the

    responsibility of one or more people$

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    20/82

    Database Solutions (2ndEdition)

    *.& 6xplain the purpose and scope of database security.

    Security considerations do not only apply to the data held in a database$ ,reaches of security

    may affect other parts of the system& !hich may in turn affect the database$ 4onseuently&

    database security encompasses hard!are& soft!are& people& and data$ .o effectively implement

    security reuires appropriate controls& !hich are defined in specific mission ob'ectives for thesystem$ .his need for security& !hile often having been neglected or overlooed in the past& is

    no! increasingly recogni#ed by organi#ations$ .he reason for this turn/around is due to the

    increasing amounts of crucial corporate data being stored on computer and the acceptance that

    any loss or unavailability of this data could be potentially disastrous$

    *.' List the main types of threat that could affect a database system and for each

    describe the possible outcomes for an or"ani>ation.

    2

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    21/82

    Database Solutions (2ndEdition)

    =i"ure *.1 A summary of the potential threats to computer systems$

    *.* 6xplain the followin" in terms of providin" security for a database#

    authori>ation

    views

    bac2up and recovery

    inte"rity

    encryption

    R?I!.

    ?uthori>ation

    Authori#ation is the granting of a right or privilege that enables a sub'ect to have legitimate

    access to a system or a system"s ob'ect$ Authori#ation controls can be built into the soft!are&

    and govern not only !hat database system or ob'ect a specified user can access& but also !hat

    the user may do !ith it$ .he process of authori#ation involves authentication of a sub'ect

    2

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    22/82

    Database Solutions (2ndEdition)

    reuesting access to an ob'ect& !here 6sub'ect" represents a user or program and 6ob'ect"

    represents a database table& vie!& procedure& trigger& or any other ob'ect that can be created

    !ithin the database system$

    @iews

    A vie! is a virtual tablethat does not necessarily exist in the database but can be produced

    upon reuest by a particular user& at the time of reuest$ .he vie! mechanism provides a

    po!erful and flexible security mechanism by hiding parts of the database from certain users$

    .he user is not a!are of the existence of any columns or ro!s that are missing from the vie!$ A

    vie! can be defined over several tables !ith a user being granted the appropriate privilege to

    use it& but not to use the base tables$ 9n this !ay& using a vie! is more restrictive than simply

    having certain privileges granted to a user on the base table(s)$

    (ac2up and recovery

    ,acup is the process of periodically taing a copy of the database and log file (and possibly

    programs) onto offline storage media$ A D,-S should provide bacup facilities to assist !ith

    the recovery of a database follo!ing failure$ .o eep trac of database transactions& the D,-S

    maintains a special file called a log file(or 'ournal) that contains information about all updates

    to the database$ 9t is al!ays advisable to mae bacup copies of the database and log file at

    regular intervals and to ensure that the copies are in a secure location$ 9n the event of a failure

    that renders the database unusable& the bacup copy and the details captured in the log file are

    used to restore the database to the latest possible consistent state$ Iournaling is the process

    of eeping and maintaining a log file (or 'ournal) of all changes made to the database to enable

    recovery to be undertaen effectively in the event of a failure$

    Inte"rity constraints

    4ontribute to maintaining a secure database system by preventing data from becoming invalid&

    and hence giving misleading or incorrect results$

    6ncryption

    9s the encoding of the data by a special algorithm that renders the data unreadable by any

    program !ithout the decryption ey$ 9f a database system holds particularly sensitive data& it

    may be deemed necessary to encode it as a precaution against possible external threats or

    22

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    23/82

    Database Solutions (2ndEdition)

    attempts to access it$ Some D,-Ss provide an encryption facility for this purpose$ .he D,-S

    can access the data (after decoding it)& although there is degradation in performance because

    of the time taen to decode it$ Encryption also protects data transmitted over communication

    lines$ .here are a number of techniues for encoding data to conceal the information; some aretermed irreversible and others reversible$ 9rreversible techniues& as the name implies& do not

    permit the original data to be no!n$ 3o!ever& the data can be used to obtain valid statistical

    information$

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    24/82

    Database Solutions (2ndEdition)

    Chapter =act-=indin" - Review questions

    .1 (riefly describe what the process of fact-findin" attempts to achieve for a database

    developer.

    %act/finding is the formal process of using techniues such as intervie!s and uestionnaires to

    collect facts about systems& reuirements& and preferences$

    .he database developer uses fact/finding techniues at various stages throughout the database

    systems lifecycle to capture the necessary facts to build the reuired database system$ .henecessary facts cover the business and the users of the database system& including the

    terminology& problems& opportunities& constraints& reuirements& and priorities$ .hese facts are

    captured using fact/findingtechniues$

    . !escribe how fact-findin" is used throu"hout the sta"es of the database system

    development lifecycle.

    .here are many occasions for fact/finding during the database system development lifecycle$

    3o!ever& fact/finding is particularly crucial to the early stages of the lifecycle& including the

    database planning& system definition& and reuirements collection and analysis stages$ 9t"s during

    these early stages that the database developer learns about the terminology& problems&

    opportunities& constraints& reuirements& and priorities of the business and the users of the

    system$ %act/finding is also used during database design and the later stages of the lifecycle&

    but to a lesser extent$ %or example& during physical database design& fact/finding becomes

    technical as the developer attempts to learn more about the D,-S selected for the database

    system$ Also& during the final stage& operational maintenance& fact/finding is used to determine

    !hether a system reuires tuning to improve performance or further developed to include ne!

    reuirements$

    27

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    25/82

    Database Solutions (2ndEdition)

    .& =or each sta"e of the database system development lifecycle identify examples of the

    facts captured and the documentation produced.

    28

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    26/82

    Database Solutions (2ndEdition)

    .' ? database developer normally uses several fact-findin" techniques durin" a sin"le

    database pro4ect. +he five most commonly used techniques are examinin"

    documentation interviewin" observin" the business in operation conductin" research

    and usin" questionnaires. !escribe each fact-findin" technique and identify the

    advanta"es and disadvanta"es of each.

    6xaminin" documentationcan be useful !hen you"re trying to gain some insight as to ho! the

    need for a database arose$ ou may also find that documentation can be helpful to provide

    information on the business (or part of the business) associated !ith the problem$ 9f the

    problem relates to the current system there should be documentation associated !ith that

    system$ Examining documents& forms& reports& and files associated !ith the current system& is a

    good !ay to uicly gain some understanding of the system$

    Interviewin"is the most commonly used& and normally most useful& fact/finding techniue$ ou

    can intervie! to collect information from individuals face/to/face$ .here can be several

    ob'ectives to using intervie!ing such as finding out facts& checing facts& generating user

    interest and feelings of involvement& identifying reuirements& and gathering ideas and opinions$

    /bservationis one of the most effective fact/finding techniues you can use to understand a

    system$ ?ith this techniue& you can either participate in& or !atch a person perform activities

    to learn about the system$ .his techniue is particularly useful !hen the validity of data

    2@

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    27/82

    Database Solutions (2ndEdition)

    collected through other methods is in uestion or !hen the complexity of certain aspects of the

    system prevents a clear explanation by the end/users$

    A useful fact/finding techniue is to researchthe application and problem$ 4omputer trade

    'ournals& reference boos& and the 9nternet are good sources of information$ .hey can provide

    you !ith information on ho! others have solved similar problems& plus you can learn !hether or

    not soft!are pacages exist to solve your problem$

    Another fact/finding techniue is to conduct surveys through questionnaires$ *uestionnairesare special/purpose documents that allo! you to gather facts from a large number of people

    2

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    28/82

    Database Solutions (2ndEdition)

    !hile maintaining some control over their responses$ ?hen dealing !ith a large audience& no

    other fact/finding techniue can tabulate the same facts as efficiently$

    .* !escribe the purpose of definin" a mission statement and mission ob4ectives for a

    database system.

    .he mission statement defines the ma'or aims of the database system$ .hose driving the

    database pro'ect !ithin the business (such as the Director andor o!ner) normally define the

    mission statement$ A mission statement helps to clarify the purpose of the database pro'ect

    and provides a clearer path to!ards the efficient and effective creation of the reuired

    database system$

    >nce the mission statement is defined& the next activity involves identifying the mission

    ob'ectives$ Each mission ob'ective should identify a particular tas that the database must

    support$ .he assumption is that if the database supports the mission ob'ectives then the

    mission statement should be met$ .he mission statement and ob'ectives may be accompanied

    !ith additional information that specifies& in general terms& the !or to be done& the resources

    !ith !hich to do it& and the money to pay for it all$

    2F

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    29/82

    Database Solutions (2ndEdition)

    . 9hat is the purpose of the systems definition sta"e3

    .he purpose of the system definition stage is to identify the scope and boundary of the

    database system and its ma'or user vie!s$ Defining the scope and boundary of the database

    system helps to identify the main types of data mentioned in the intervie!s and a rough guide as

    to ho! this data is related$ A user vie! represents the reuirements that should be supported

    by a database system as defined by a particular 'ob role (such as -anager or Assistant) or

    business application area (such as video rentals or stoc control)$

    . 7ow do the contents of a users< requirements specification differ from a systems

    specification3

    .here are t!o main documents created during the reuirements collection and analysis stage&

    namely the users" reuirements specification and the systems specification$

    .he users" reuirements specification describes in detail the data to be held in the database

    and ho! the data is to be used$

    .he systems specification describes any features to be included in the database system such as

    the reuired performance and the levels of security$

    .5 !escribe one approach to decidin" whether to use centrali>ed view inte"ration or a

    combination of both when developin" a database system for multiple user views.

    >ne !ay to help you mae a decision !hether to use the centrali#ed& vie! integration& or a

    combination of both approaches to manage multiple user vie!s is to examine the overlap in terms

    of the data used bet!een the user vie!s identified during the system definition stage$

    9t"s difficult to give precise rules as to !hen it"s appropriate to use the centrali#ed or vie!

    integration approaches$ As the database developer& you should base your decision on an

    assessment of the complexity of the database system and the degree of overlap bet!een the

    various user vie!s$ 3o!ever& !hether you use the centrali#ed or vie! integration approach or a

    mixture of both to build the underlying database& ultimately you need to create the original user

    vie!s for the !oring database system$

    2

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    30/82

    Database Solutions (2ndEdition)

    Chapter 6ntity-Relationship )odelin" - Review questions

    .1 !escribe what entities represent in an 6R model and provide examples of entities with

    a physical or conceptual existence.

    Entity is a set of ob'ects !ith the same properties& !hich are identified by a user or company as

    having an independent existence$ Each ob'ect& !hich should be uniuely identifiable !ithin the

    set& is called an entity occurrence$An entity has an independent existence and can represent

    ob'ects !ith a physical (or 6real") existence or ob'ects !ith a conceptual (or 6abstract")

    existence$

    . !escribe what relationships represent in an 6R model and provide examples of unary

    binary and ternary relationships.

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    31/82

    Database Solutions (2ndEdition)

    !hich represents an association of staff !ith a supervisor !here the supervisor is also a

    member of staff$ 9n other !ords& the Staff entity participates t!ice in the Supervises

    relationship; the first participation as a supervisor& and the second participation as a member of

    staff !ho is supervised (supervisee)$ See %igure $8 for a diagrammatic representation of theSupervisesrelationship$

    A relationship of degree t!o is called binary$

    A relationship of a degree higher than binary is called a complex relationship$ A relationship of

    degree three is called ternary$ An example of a ternary relationship is

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    32/82

    Database Solutions (2ndEdition)

    =i"ure .' Example of a ternary relationship called

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    33/82

    Database Solutions (2ndEdition)

    !erived attribute is an attribute that represents a value that is derivable from the value of a

    related attribute& or set of attributes& not necessarily in the same entity$ Some attributes may

    be related for a particular entity$ %or example& the age of a member of staff ( age) is derivable

    from the date of birth (D>,) attribute& and therefore the ageand D>,attributes are related$?e refer to the ageattribute as a derived attribute& the value of !hich is derived from the

    D>,attribute$

    .' !escribe what multiplicity represents for a relationship.

    )ultiplicityis the number of occurrences of one entity that may relate to a single occurrence of

    an associated entity$

    .* 9hat are business rules and how does multiplicity model these constraints3

    -ultiplicity constrains the number of entity occurrences that relate to other entity

    occurrences through a particular relationship$ -ultiplicity is a representation of the policies

    established by the user or company& and is referred to as a business rule$ Ensuring that all

    appropriate business rules are identified and represented is an important part of modeling a

    company$

    .he multiplicity for a binary relationship is generally referred to as one/to/one (:)& one/to/

    many (:)& or many/to/many (:)$ Examples of three types of relationships include:

    A member of staff manages a branch$

    A branch has members of staff$

    Actors play in videos$

    . 7ow does multiplicity represent both the cardinality and the participation constraints

    on a relationship3

    -ultiplicity actually consists of t!o separate constraints no!n as cardinality and participation$

    Cardinality describes the number of possible relationships for each participating entity$

    ,articipation determines !hether all or only some entity occurrences participate in a

    relationship$ .he cardinality of a binary relationship is !hat !e have been referring to as one/

    to/one& one/to/many& and many/to/many$ A participation constraint represents !hether all entity

    occurrences are involved in a particular relationship (mandatory participation) or only some

    55

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    34/82

    Database Solutions (2ndEdition)

    (optional participation)$ .he cardinality and participation constraints for the Staff-anages

    ,ranchrelationship are sho!n in %igure $$

    . ,rovide an example of a relationship with attributes.

    An example of a relationship !ith an attribute is the relationship called 1lays9n& !hich

    associates the Actor and 0ideoentities$ ?e may !ish to record the character played by an

    actor in a given video$ .his information is associated !ith the 1lays9nrelationship rather than

    the Actoror 0ideoentities$ ?e create an attribute called characterto store this information

    and assign it to the 1lays9nrelationship& as illustrated in %igure $2$ Bote& in this figure the

    characterattribute is sho!n using the symbol for an entity; ho!ever& to distinguish bet!een a

    relationship !ith an attribute and an entity& the rectangle representing the attribute isassociated !ith the relationship using a dashed line$

    57

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    35/82

    Database Solutions (2ndEdition)

    %igure $2 A relationship called 1lays9n!ith an attribute called character$

    .5 !escribe how stron" and wea2 entities differ and provide an example of each.

    ?e can classify entities as being either strong or !ea$ A stron" entityis notdependent on the

    existence of another entity for its primary ey$ A wea2 entity is partially or !holly dependent

    on the existence of another entity& or entities& for its primary ey$ %or example& as !e can

    distinguish one actor from all other actors and one video from all other videos !ithout the

    existence of any other entity& Actor and 0ideoare referred to as being strong entities$ 9n

    other !ords& the Actorand 0ideoentities are strong because they have their o!n primary eys$

    An example of a !ea entity called

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    36/82

    Database Solutions (2ndEdition)

    =i"ure . Diagrammatic representation of attributes for the 0ideo&

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    37/82

    Database Solutions (2ndEdition)

    A chasm trap may occur !hen an E< model suggests the existence of a relationship bet!een

    entities& but the path!ay does not exist bet!een certain entity occurrences$ -ore specifically&

    a chasm trap may occur !here there is a relationship !ith optional participation that forms part

    of the path!ay bet!een the entities that are related$ Again& a chasm trap may be resolved bythe addition of a direct relationship bet!een the t!o entities that !ere originally related

    through a path!ay that included optional participation$

    5

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    38/82

    Database Solutions (2ndEdition)

    Chapter 5 Dormali>ation E Review questions

    5.1 !iscuss how normali>ation may be used in database desi"n.

    Bormali#ation can be used in database design in t!o !ays: the first is to use normali#ation as a

    bottom/up approach to database design; the second is to use normali#ation in con'unction !ith

    E< modeling$

    =sing normali#ation as a bottom-up approachinvolves analy#ing the associations bet!een

    attributes and& based on this analysis& grouping the attributes together to form tables that

    represent entities and relationships$ 3o!ever& this approach becomes difficult !ith a largenumber of attributes& !here it"s difficult to establish all the important associations bet!een

    the attributes$ Alternatively& you can use a top-down approach to database design$ 9n this

    approach& !e use E< modeling to create a data model that represents the main entities and

    relationships$ ?e then translate the E< model into a set of tables that represents this data$

    9t"s at this point that !e use normali#ation to chec !hether the tables are !ell designed$

    5. !escribe the types of update anomalies that may occur on a table that has redundant

    data.

    .ables that have redundant data may have problems called update anomalies& !hich are

    classified as insertion& deletion& or modification anomalies$ See %igure F$2 for an example of a

    table !ith redundant data called Staff,ranch$.here are t!o main types of insertion anomalies&

    !hich !e illustrate using this table$

    9nsertion anomalies

    () .o insert the details of a ne! member of staff located at a given branch into the

    Staff,ranchtable& !e must also enter the correct details for that branch$ %or example& to

    insert the details of a ne! member of staff at branch ,2& !e must enter the correct

    details of branch ,2 so that the branch details are consistent !ith values for branch

    ,2 in other records of the Staff,ranchtable$ .he data sho!n in the Staff,ranchtable

    is also sho!n in the Staff and ,ranchtables sho!n in %igure F$$ .hese tables do have

    redundant data and do not suffer from this potential inconsistency& because for each staff

    member !e only enter the appropriate branch number into the Stafftable$ 9n addition& the

    5F

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    39/82

    Database Solutions (2ndEdition)

    details of branch ,2 are recorded only once in the database as a single record in the

    ,ranchtable$

    (2) .o insert details of a ne! branch that currently has no members of staff into the

    Staff,ranchtable& it"s necessary to enter nulls into the staff/related columns& such asstaffBo$ 3o!ever& as staffBois the primary ey for the Staff,ranchtable& attempting to

    enter nulls for staffBoviolates entity integrity& and is not allo!ed$ .he design of the tables

    sho!n in %igure F$ avoids this problem because ne! branch details are entered into the

    ,ranchtable separately from the staff details$ .he details of staff ultimately located at a

    ne! branch can be entered into the Stafftable at a later date$

    !eletion anomalies

    9f !e delete a record from the Staff,ranchtable that represents the last member of staff

    located at a branch& the details about that branch are also lost from the database$ %or example&

    if !e delete the record for staff Art 1eters (S78) from the Staff,ranchtable& the details

    relating to branch ,5 are lost from the database$ .he design of the tables in %igure F$

    avoids this problem because branch records are stored separately from staff records and only

    the column branchBorelates the t!o tables$ 9f !e delete the record for staff Art 1eters

    (S78) from the Staff table& the details on branch ,5 in the ,ranch table remain

    unaffected$

    )odification anomalies

    9f !e !ant to change the value of one of the columns of a particular branch in the Staff,ranch

    table& for example the telephone number for branch ,& !e must update the records of all

    staff located at that branch$ 9f this modification is not carried out on all the appropriate

    records of the Staff,ranch table& the database !ill become inconsistent$ 9n this example&

    branch , !ould have different telephone numbers in different staff records$

    .he above examples illustrate that the Staff and ,ranchtables of %igure F$ have more

    desirable properties than the Staff,ranchtable of %igure F$2$ 9n the follo!ing sections& !e

    examine ho! normal forms can be used to formali#e the identification of tables that have

    desirable properties from those that may potentially suffer from update anomalies$

    5

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    40/82

    Database Solutions (2ndEdition)

    5.& !escribe the characteristics of a table that violates first normal form $1D=% and then

    describe how such a table is converted to 1D=.

    .he rule forfirst normal form $1D=% is a table in !hich the intersection of every column and

    record contains only onevalue$ 9n other !ords a table that contains more than one atomic value

    in the intersection of one or more column for one or more records is not in B%$ .he non B%

    table can be converted to B% by restructuring original table by removing the column !ith the

    multi/values along !ith a copy of the primary ey to create a ne! table$ See %igure F$7 for an

    example of this approach$ .he advantage of this approach is that the resultant tables may be in

    normal forms later that B%$

    5.' 9hat is the minimal normal form that a relation must satisfy3 ,rovide a definition for

    this normal form.

    >nly first normal form (B%) is critical in creating appropriate tables for relational databases$

    All the subseuent normal forms are optional$ 3o!ever& to avoid the update anomalies discussed

    in Section F$2& it"s normally recommended that you proceed to third normal form (5B%)$

    =irst normal form $1D=% is a table in !hich the intersection of every column and record

    contains only onevalue$

    5.* !escribe an approach to convertin" a first normal form $1D=% table to second normal

    form $D=% table$s%.

    Second normal form applies only to tables !ith composite primary eys& that is& tables !ith a

    primary ey composed of t!o or more columns$ A B% table !ith a single column primary ey is

    automatically in at least 2B%$

    A second normal form $D=% is a table that is already in B% and in !hich the values in each

    non/primary/ey column can be !ored out from the values in allthe columns that maes up the

    primary ey$

    A table in B% can be converted into 2B% by removing the columns that can be !ored out from

    only part of the primary ey$ .hese columns are placed in a ne! table along !ith a copy of the

    part of the primary ey that they can be !ored out from$

    7

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    41/82

    Database Solutions (2ndEdition)

    5. !escribe the characteristics of a table in second normal form $D=%.

    Second normal form $D=% is a table that is already in B% and in !hich the values in each non/

    primary/ey column can only be !ored out from the values in allthe columns that mae up the

    primary ey$

    5. !escribe what is meant by full functional dependency and describe how this type of

    dependency relates to D=. ,rovide an example to illustrate your answer.

    .he formal definition of second normal form$D=%is a table that is in first normal form and

    every non/primary/ey column is fully functionally dependenton the primary ey$ %ull functional

    dependency indicates that if Aand ,are columns of a table& ,is fully functionally dependent on

    A& if ,is not dependent on any subset of A$ 9f ,is dependent on a subset of A& this is referred

    to as a partial dependency$ 9f a partial dependency exists on the primary ey& the table is not in

    2B%$ .he partial dependency must be removed for a table to achieve 2B%$

    See Section 5.'for an example$

    5.5 !escribe the characteristics of a table in third normal form $&D=%.

    +hird normal form $&D=% is a table that is already in B% and 2B%& and in !hich the values in

    all non/primary/ey columns can be !ored out from onlythe primary ey (or candidate ey)

    column(s) and no other columns$

    5.A !escribe what is meant by transitive dependency and describe how this type of

    dependency relates to &D=. ,rovide an example to illustrate your answer.

    .he formal definition for third normal form$&D=%is a table that is in first and second normal

    forms and in !hich no non/primary/ey column is transitively dependenton the primary ey$

    .ransitive dependency is a type of functional dependency that occurs !hen a particular type of

    relationship holds bet!een columns of a table$ %or example& consider a table !ith columns A& ,&

    and 4$ 9f ,is functionally dependent on A(A ,) and 4is functionally dependent on ,(, 4)&

    then 4is transitively dependent on Avia ,(provided that Ais not functionally dependent on ,

    or 4)$ 9f a transitive dependency exists on the primary ey& the table is not in 5B%$ .he

    transitive dependency must be removed for a table to achieve 5B%$See Section 5.*for an example$

    7

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    42/82

    Database Solutions (2ndEdition)

    Chapter A Lo"ical !atabase !esi"n E Step 1- Review questions

    A.1 !escribe the purpose of a desi"n methodolo"y.

    A design methodology is a structured approach that uses procedures& techniues& tools& and

    documentation aids to support and facilitate the process of design$

    A. !escribe the main phases involved in database desi"n.

    Database design is made up of t!o main phases: logical and physical database design$

    Lo"ical database desi"nis the process of constructing a model of the data used in a company

    based on a specific data model& but independent of a particular D,-S and other physical

    considerations$

    9n the logical database design phase !e build the logical representation of the database&

    !hich includes identification of the important entities and relationships& and then translate this

    representation to a set of tables$ .he logical data model is a source of information for the

    physical design phase& providing the physical database designer !ith a vehicle for maing

    tradeoffs that are very important to the design of an efficient database$

    ,hysical database desi"nis the process of producing a description of the implementation of

    the database on secondary storage; it describes the base tables& file organi#ations& and indexes

    used to achieve efficient access to the data& and any associated integrity constraints and

    security restrictions$ 9n the physical database design phase !e decide ho! the logical design is

    to be physically implemented in the target relational D,-S$ .his phase allo!s the designer to

    mae decisions on ho! the database is to be implemented$ .herefore& physical design is tailored

    to a specific D,-S$

    A.& Identify important factors in the success of database desi"n.

    .he follo!ing are important factors to the success of database design:

    ?or interactively !ith the users as much as possible$

    %ollo! a structured methodology throughout the data modeling process$

    Employ a data/driven approach$

    9ncorporate structural and integrity considerations into the data models$

    =se normali#ation and transaction validation techniues in the methodology$

    =se diagrams to represent as much of the data models as possible$

    72

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    43/82

    Database Solutions (2ndEdition)

    =se a database design language (D,D+)$

    ,uild a data dictionary to supplement the data model diagrams$

    ,e !illing to repeat steps$

    A.' !iscuss the important role played by users in the process of database desi"n.

    =sers play an essential role in confirming that the logical database design is meeting their

    reuirements$ +ogical database design is made up of t!o steps and at the end of each step

    (Steps $ and 2$8) users are reuired to revie! the design and provide feedbac to the

    designer$ >nce the logical database design has been 6signed off" by the users the designer can

    continue to the physical database design stage$

    A.* !iscuss the main activities associated with each step of the lo"ical database desi"n

    methodolo"y.

    .he logical database design phase of the methodology is divided into t!o main steps$

    9n Step!e create a data model and chec that the data model has minimal redundancy and

    is capable of supporting user transactions$ .he output of this step is the creation of a

    logical data model& !hich is a complete and accurate representation of the company (or part

    of the company) that is to be supported by the database$

    9n Step 2!e map the E< model to a set of tables$ .he structure of each table is checed

    using normali#ation$ Bormali#ation is an effective means of ensuring that the tables are

    structurally consistent& logical& !ith minimal redundancy$ .he tables are also checed to

    ensure that they are capable of supporting the reuired transactions$ .he reuired integrity

    constraints on the database are also defined$

    A. !iscuss the main activities associated with each step of the physical database desi"n

    methodolo"y.

    1hysical database design is divided into six main steps:

    Step 5involves the design of the base tables and integrity constraints using the available

    functionality of the target D,-S$

    Step 7 involves choosing the file organi#ations and indexes for the base tables$ .ypically&

    D,-Ss provide a number of alternative file organi#ations for data& !ith the exception of 14

    D,-Ss& !hich tend to have a fixed storage structure$

    75

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    44/82

    Database Solutions (2ndEdition)

    Step 8 involves the design of the user vie!s originally identified in the reuirements

    analysis and collection stage of the database system development lifecycle$

    Step @ involves designing the security measures to protect the data from unauthori#ed

    access$

    Step considers relaxing the normali#ation constraints imposed on the tables to improve

    the overall performance of the system$ .his is a step that you should undertae only if

    necessary& because of the inherent problems involved in introducing redundancy !hile still

    maintaining consistency$

    Step Fis an ongoing process of monitoring and tuning the operational system to identify and

    resolve any performance problems resulting from the design and to implement ne! orchanging reuirements$

    A. !iscuss the purpose of Step 1 of lo"ical database desi"n.

    1urpose of Step is to build a logical data model of the data reuirements of a company (or part

    of a company) to be supported by the database$

    Each logical data model comprises:

    entities&

    relationships&

    attributes and attribute domains&

    primary eys and alternate eys&

    integrity constraints$

    .he logical data model is supported by documentation& including a data dictionary and En the other hand& it"s un!ise not to perform

    some such chec$ 3o!ever& missing relationships should become apparent !hen you chec the

    model supports the transactions that the users reuire$ >n the other hand& it is possible that anentity can have no relationship !ith other entities in the database but still play an important

    part in meeting the user"s reuirements$

    A.1B !iscuss an approach to identifyin" attributes from a users< requirements

    specification and the association of attributes with entities or relationships.

    9n a similar !ay to identifying entities& loo for nouns or noun phrases in the users" reuirements

    specification$ .he attributes can be identified !here the noun or noun phrase is a property&

    uality& identifier& or characteristic of one of the entities or relationships that you"ve previously

    found$

    ,y far the easiest thing to do !hen you"ve identified an entity or a relationship in the users"

    reuirements specification is to consider K?hat information are !e reuired to hold on $ $ $JL$

    .he ans!er to this uestion should be described in the specification$ 3o!ever& in some cases&

    you may need to as the users to clarify the reuirements$ =nfortunately& they may give you

    ans!ers that also contain other concepts& so users" responses must be carefully considered$

    A.11 !iscuss an approach to chec2in" a data model for redundancy. 8ive an example to

    illustrate your answer.

    .here are three approaches to identifying !hether a data model suffers from redundancy:

    () re/examining one/to/one (:) relationships;

    (2) removing redundant relationships;

    (5) considering the time dimension !hen assessing redundancy$

    3o!ever& to ans!er this uestion you need only describe one approach$ ?e describe approach ()

    here$

    ?n example of approach $1%

    9n the identification of entities& you may have identified t!o entities that represent the same

    ob'ect in the company$ %or example& you may have identified t!o entities named ,ranch and

    7@

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    47/82

    Database Solutions (2ndEdition)

    >utletthat are actually the same; in other !ords& ,ranchis a synonym for >utlet$ 9n this case&

    the t!o entities should be merged together$ 9f the primary eys are different& choose one of

    them to be the primary ey and leave the other as an alternate ey$

    A.1 !escribe two approaches to chec2in" that a lo"ical data model supports the

    transactions required by the user.

    .he t!o possible approaches to ensuring that the logical data model supports the reuired

    transactions& includes:

    $1% !escribin" the transaction

    =sing the first approach& you chec that all the information (entities& relationships& and their

    attributes) reuired by each transaction is provided by the model& by documenting a description

    of each transaction"s reuirements$

    $% :sin" transaction pathways

    .he second approach to validating the data model against the reuired transactions involves

    representing the path!ay taen by each transaction directly on the E< diagram$ 4learly& the

    more transactions that exist& the more complex this diagram !ould become& so for readability

    you may need several such diagrams to cover all the transactions$

    A.1& Identify and describe the purpose of the documentation "enerated durin" Step 1 of

    lo"ical database desi"n.

    !ocument entities

    .he data dictionary describes the entities including the entity name& description& aliases& and

    occurrences$

    7

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    48/82

    Database Solutions (2ndEdition)

    =i"ure A. Extract from the data dictionary for the ,ranch user vie!s of Stay3omesho!ing a

    description of entities$

    6R dia"rams

    .hroughout the database design phase& E< diagrams are used !henever necessary& to help build

    up a picture of !hat you"re attempting to model$ Different people use different notations for

    E< diagrams$ 9n this boo& !e"ve used the latest ob'ect/oriented notation called :)L $:nified

    )odelin" Lan"ua"e%& but other notations perform a similar function$

    !ocument relationships

    As you identify relationships& assign them names that are meaningful and obvious to the user&

    and also record relationship descriptions& and the multiplicity constraints in the data dictionary$

    7F

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    49/82

    Database Solutions (2ndEdition)

    =i"ure A. Extract from the data dictionary for the ,ranch user vie!s of Stay3ome

    sho!ing descriptions of relationships$

    !ocument attributes

    As you identify attributes& assign them names that are meaningful and obvious to the user$

    ?here appropriate& record the follo!ing information for each attribute:

    attribute name and description;

    data type and length;

    any aliases that the attribute is no!n by;

    !hether the attribute must al!ays be specified (in other !ords& !hether the attribute

    allo!s or disallo!s nulls);

    !hether the attribute is multi/valued;

    !hether the attribute is composite& and if so& !hich simple attributes mae up the

    composite attribute;

    !hether the attribute is derived and& if so& ho! it should be computed;

    default values for the attribute (if specified)$

    7

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    50/82

    Database Solutions (2ndEdition)

    =i"ure A.5 Extract from the data dictionary for the ,ranch user vie!s of Stay3ome

    sho!ing descriptions of attributes$

    !ocument attribute domains

    As you identify attribute domains& record their names and characteristics in the datadictionary$ =pdate the data dictionary entries for attributes to record their domain in place of

    the data type and length information$

    !ocument candidate primary and alternate 2eys

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    51/82

    Database Solutions (2ndEdition)

    =i"ure A.1B Extract from the data dictionary for the ,ranch user vie!s of Stay3omesho!ing

    attributes !ith primary and alternate eys identified$

    !ocument entities

    ou no! have a logical data model that represents the database reuirements of the company

    (or part of the company)$ .he logical data model is checed to ensure that the model supports

    the reuired transactions$ .his process creates documentation that ensures that all the

    information (entities& relationships& and their attributes) reuired by each transaction is

    provided by the model& by documenting a description of each transaction"s reuirements$

    Alternative approach to validating the data model against the reuired transactions involves

    representing the path!ay taen by each transaction directly on the E< diagram$ 4learly& the

    more transactions that exist& the more complex this diagram !ould become& so for readabilityyou may need several such diagrams to cover all the transactions$

    8

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    52/82

    Database Solutions (2ndEdition)

    Chapter 1B Lo"ical !atabase !esi"n E Step E Review questions

    1B.1 !escribe the main purpose and tas2s of Step of the lo"ical database desi"n

    methodolo"y.

    .o create tables for the logical data model and to chec the structure of the tables$

    .he tass involved in Step 2 are:

    Step 2$ 4reate tables

    Step 2$2 4hec table structures using normali#ation

    Step 2$5 4hec tables support user transactions

    Step 2$7 4hec business rules

    Step 2$8

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    53/82

    Database Solutions (2ndEdition)

    Examples are provided throughout the description of Step 2$ in 4hapter $

    1B.& !iscuss how the technique of normali>ation can be used to chec2 the structure of

    the tables created from the 6R model and supportin" documentation.

    .he purpose of the techniue of normali#ation to examine the groupings of columns in each table

    created in Step 2$$ ou chec the composition of each table using the rules of normali#ation& to

    avoid unnecessary duplication of data$

    ou should ensure that each table created is in at least third normal form (5B%)$ 9f you identifytables that are not in 5B%& this may indicate that part of the E< model is incorrect& or that you

    have introduced an error !hile creating the tables from the model$ 9f necessary& you may need

    to restructure the data model andor tables$

    1B.' !iscuss one approach that can be used to chec2 that the tables support the

    transactions required by the users.

    >ne approach to checing that the tables support a transaction is to examine the transaction"sdata reuirements to ensure that the data is present in one or more tables$ Also& if a

    85

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    54/82

    Database Solutions (2ndEdition)

    transaction reuires data in more than one table you should chec that these tables are lined

    through the primary eyforeign ey mechanism$

    1B.* !iscuss what business rules represent. 8ive examples to illustrate your answers.

    ,usiness rules are the constraints that you !ish to impose in order to protect the database

    from becoming incomplete& inaccurate& or inconsistent$ Although you may not be able to

    implement some business rules !ithin the D,-S& this is not the uestion here$ At this stage& you

    are concerned only !ith high/level design that is& specifying !hatbusiness rules are reuired

    irrespective of ho!this might be achieved$ 3aving identified the business rules& you !ill have a

    logical data model that is a complete and accurate representation of the organi#ation (or part of

    the organi#ation) to be supported by the database$ 9f necessary& you could produce a physical

    database design from the logical data model& for example& to prototype the system for the user$

    ?e consider the follo!ing types of business rules:

    reuired data&

    column domain constraints&

    entity integrity&

    multiplicity&

    referential integrity& other business rules$

    1B.* !escribe the alternative strate"ies that can be applied if there is a child record

    referencin" a parent record that we wish to delete.

    9f a record of the parent table is deleted& referential integrity is lost if there is a child record

    referencing the deleted parent record$ 9n other !ords& referential integrity is lost if the

    deleted branch currently has one or more members of staff !oring at it$ .here are severalstrategies you can consider in this case:

    B> A4.9>B 1revent a deletion from the parent table if there are any referencing child

    records$ 9n our example& 6ou cannot delete a branch if there are currently members of staff

    !oring there"$

    4AS4ADE ?hen the parent record is deleted& automatically delete any referencing child

    records$ 9f any deleted child record also acts as a parent record in another relationship then

    the delete operation should be applied to the records in this child table& and so on in a cascading

    manner$ 9n other !ords& deletions from the parent table cascade to the child table$ 9n our

    87

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    55/82

    Database Solutions (2ndEdition)

    example& 6Deleting a branch automatically deletes all members of staff !oring there"$ 4learly& in

    this situation& this strategy !ould not be !ise$

    SE. B=++ ?hen a parent record is deleted& the foreign ey values in all related child

    records are automatically set to null$ 9n our example& 69f a branch is deleted& indicate that thecurrent branch for those members of staff previously !oring there is unno!n"$ ou can only

    consider this strategy if the columns comprising the foreign ey can accept nulls& as defined in

    Step $5$

    SE. DE%A=+. ?hen a parent record is deleted& the foreign ey values in all related child

    records are automatically set to their default values$ 9n our example& 69f a branch is deleted&

    indicate that the current assignment of members of staff previously !oring there is being

    assigned to another (default) branch"$ ou can only consider this strategy if the columns

    comprising the foreign ey have default values& as defined in Step $5$

    B> 43E4M ?hen a parent record is deleted& do nothing to ensure that referential integrity

    is maintained$ .his strategy should only be considered in extreme circumstances$

    1B. !iscuss what business rules represent. 8ive examples to illustrate your answers.

    %inally& you consider constraints no!n as business rules$ ,usiness rules should be represented

    as constraints on the database to ensure that only permitted updates to tables governed by

    6real !orld" transactions are allo!ed$ %or example& Stay3omehas a business rule that prevents

    a member from renting more than videos at any one time$

    88

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    56/82

    Database Solutions (2ndEdition)

    Chapter 11 6nhanced 6ntity-Relationship )odelin" E Review questions

    11.1 !escribe what a superclass and a subclass represent.

    Superclass is an entity that includes one or more distinct groupings of its occurrences& !hich

    reuire to be represented in a data model$ Subclass is a distinct grouping of occurrences of an

    entity& !hich reuire to be represented in a data model$

    11. !escribe the relationship between a superclass and its subclass.

    .he relationship bet!een a superclass and any one of its subclasses is one/to/one (:) and is

    called a superclasssubclass relationship$ %or example& Staff-anager forms a

    superclasssubclass relationship$ Each member of a subclass is also a member of the superclass

    but has a distinct role$

    11.& !escribe and illustrate usin" an example the process of attribute inheritance.

    An entity occurrence in a subclass represents the same 6real !orld" ob'ect as in the superclass$

    3ence& a member of a subclass inherits those attributes associated !ith the superclass& but

    may also have subclass/specific attributes$ %or example& a member of the Sales1ersonnel

    subclass has subclass/specific attributes& salesArea& veh+icenseBo& andcarAllo!ance& and all

    the attributes of the Staffsuperclass& namely staffBo& name& position& salary& and branchBo$

    11.' 9hat are the main reasons for introducin" the concepts of superclasses and

    subclasses into an 66R model3

    .here are t!o important reasons for introducing the concepts of superclasses and subclasses

    into an E< model$ .he first reason is that it avoids describing similar concepts more than once&

    thereby saving you time and maing the E< model more readable$ .he second reason is that it

    adds more semantic information to the design in a form that is familiar to many people$ %or

    example& the assertions that 6-anager 9S/A member of staff" and 6van 9S/A type of vehicle"

    communicate significant semantic content in an easy/to/follo! form$

    8@

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    57/82

    Database Solutions (2ndEdition)

    11.* !escribe what a shared subclass represents.

    A subclass is an entity in its o!n right and so it may also have one or more subclasses$ A subclass

    !ith more than one superclass is called a shared subclass$ 9n other !ords& a member of a shared

    subclass must be a member of the associated superclasses$ As a conseuence& the attributes of

    the superclasses are inherited by the shared subclass& !hich may also have its o!n additional

    attributes$ .his process is referred to as multiple inheritance$

    11. !escribe and contrast the process of speciali>ation with the process of

    "enerali>ation.

    Speciali>ation is the process of maximi#ing the differences bet!een members of an entity by

    identifying their distinguishing characteristics$ Speciali#ation is a top/do!n approach to defining

    a set of superclasses and their related subclasses$ .he set of subclasses is defined on the basis

    of some distinguishing characteristics of the entities in the superclass$ ?hen !e identify a

    subclass of an entity& !e then associate attributes specific to the subclass (!here necessary)&

    and also identify any relationships bet!een the subclass and other entities or subclasses (!here

    necessary)$

    8enerali>ation is the process of minimi#ing the differences bet!een entities by identifying

    their common features$ .he process of generali#ation is a bottom/up approach& !hich results in

    the identification of a generali#ed superclass from the original subclasses$ .he process of

    generali#ation can be vie!ed as the reverse of the speciali#ation process$

    11. !escribe the two main constraints that apply to a speciali>ationF"enerali>ation

    relationship.

    .here are t!o constraints that may apply to a superclasssubclass relationship called

    participation constraints and dis'oint constraints$

    ,articipation constraint determines !hether every occurrence in the superclass must

    participate as a member of a subclass$ A participation constraint may be mandatory or optional$

    A superclasssubclass relationship !ith a mandatory participation specifies that every entity

    occurrence in the superclass must also be a member of a subclass$ A superclasssubclass

    8

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    58/82

    Database Solutions (2ndEdition)

    relationship !ith optionalparticipationspecifies that a member of a superclass need not belong

    to any of its subclasses$

    !is4ointconstraint describes the relationship bet!een members of the subclasses and indicates!hether it"s possible for a member of a superclass to be a member of one& or more than one&

    subclass$ .he dis'oint constraintonly applies !hen a superclass has more than one subclass$ 9f

    the subclasses are dis'oint& then an entity occurrence can be a member of only one of the

    subclasses$ .o represent a dis'oint superclasssubclass relationship& an 6>r" is placed next to the

    participation constraint !ithin the curly bracets$ 9f subclasses of a

    speciali#ationgenerali#ation are not dis'oint (called nondis'oint)& then an entity occurrence may

    be a member of more than one subclass$ .he participation and dis'oint constraints of

    speciali#ationgenerali#ation are distinct giving the follo!ing four categories: mandatory and

    nondis'oint& optional and nondis'oint& mandatory and dis'oint& and optional and dis'oint$

    8F

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    59/82

    Database Solutions (2ndEdition)

    Chapter 1 ,hysical !atabase !esi"n E Step & E Review questions

    1.1 6xplain the difference between lo"ical and physical database desi"n. 9hy mi"ht

    these tas2s be carried out by different people3

    +ogical database design is independent of implementation details& such as the specific

    functionality of the target D,-S& application programs& programming languages& or any other

    physical considerations$ .he output of this process is a logical data model that includes a set of

    relational tables together !ith supporting documentation& such as a data dictionary$ .hese

    represent the sources of information for the physical design process& and they provide you !itha vehicle for maing trade/offs that are so important to an efficient database design$

    ?hereas logical database design is concerned !ith the !hat& physical database design is

    concerned !ith the ho!$ 9n particular& the physical database designer must no! ho! the

    computer system hosting the D,-S operates& and must also be fully a!are of the functionality

    of the target D,-S$ As the functionality provided by current systems varies !idely& physical

    design must be tailored to a specific D,-S system$ 3o!ever& physical database design is not an

    isolated activity N there is often feedbac bet!een physical& logical& and application design$ %or

    example& decisions taen during physical design to improve performance& such as merging tables

    together& might affect the logical data model$

    1. !escribe the inputs and outputs of physical database desi"n.

    .he inputs are the logical data model and the data dictionary$ .he outputs are the base tables&

    integrity rules& file organi#ation specified& secondary indexes determined& user vie!s and

    security mechanisms$

    1.& !escribe the purpose of the main steps in the physical desi"n methodolo"y

    presented in this chapter.

    Step 5 produces a relational database schema from the logical data model& !hich defines the

    base tables& integrity rules& and ho! to represent derived data$

    8

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    60/82

    Database Solutions (2ndEdition)

    1.' !escribe the types of information required to desi"n the base tables.

    ou !ill need to no!:

    ho! to create base tables;

    !hether the system supports the definition of primary eys& foreign eys& and alternate

    eys;

    !hether the system supports the definition of reuired data (that is& !hether the system

    allo!s columns to be defined as NOT NULL);

    !hether the system supports the definition of domains;

    !hether the system supports relational integrity rules;

    !hether the system supports the definition of business rules$

    1.* !escribe how you would you handle the representation of derived data in the

    database. 8ive an example to illustrate your answer.

    %rom a physical database design perspective& !hether a derived column is stored in the

    database or calculated every time it"s needed is a trade/off$ .o decide& you should calculate:

    the additional cost to store the derived data and eep it consistent !ith the data from

    !hich it is derived& and

    the cost to calculate it each time it"s reuired&

    and choose the less expensive option sub'ect to performance constraints$

    @

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    61/82

    Database Solutions (2ndEdition)

    Chapter 1& ,hysical !atabase !esi"n E Step ' E Review questions

    1&.1 !escribe the purpose of Step ' in the database desi"n methodolo"y.

    Step 7 determines the file organi#ations for the base tables$ .his taes account of the nature

    of the transactions to be carried out& !hich also determine !here secondary indexes !ill be of

    use$

    1&. !iscuss the purpose of analy>in" the transactions that have to be supported and

    describe the type of information you would collect and analy>e.

    ou can"t mae meaningful physical design decisions until you understand in detail the

    transactions that have to be supported$ 9n analy#ing the transactions& you"re attempting to

    identify performance criteria& such as:

    the transactions that run freuently and !ill have a significant impact on performance;

    the transactions that are critical to the operation of the business;

    the times of the day!ee !hen there !ill be a high demand made on the database (called

    the pea load)$

    ou"ll use this information to identify the parts of the database that may cause performance

    problems$ At the same time& you need to identify the high/level functionality of the

    transactions& such as the columns that are updated in an update transaction or the columns that

    are retrieved in a uery$ ou"ll use this information to select appropriate file organi#ations and

    indexes$

    1&.& 9hen would you not add any indexes to a table3

    () Do not index small tables$ 9t may be more efficient to search the table in memory than to

    store an additional index structure$

    (2) Avoid indexing a column or table that is freuently updated$

    (5) Avoid indexing a column if the uery !ill retrieve a significant proportion (for example&

    28O) of the records in the table& even if the table is large$ 9n this case& it may be more

    efficient to search the entire table than to search using an index$

    (7) Avoid indexing columns that consist of long character strings$

    @

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    62/82

    Database Solutions (2ndEdition)

    1&.' !iscuss some of the main reasons for selectin" a column as a potential candidate

    for indexin". 8ive examples to illustrate your answer.

    () 9n general& index the primary ey of a table if it"s not a ey of the file organi#ation$

    Although the S*+ standard provides a clause for the specification of primary eys as

    discussed in Step 5$ covered in the last chapter& note that this does not guarantee that

    the primary ey !ill be indexed in some

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    63/82

    Database Solutions (2ndEdition)

    1&.* 7avin" identified a column as a potential candidate under what circumstances would

    you decide a"ainst indexin" it3

    3aving dra!n up your 6!ish/list" of potential indexes& consider the impact of each of these on

    update transactions$ 9f the maintenance of the index is liely to slo! do!n important update

    transactions& then consider dropping the index from the list$

    @5

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    64/82

    Database Solutions (2ndEdition)

    Chapter 1' ,hysical !atabase !esi"n E Steps * and E Review questions

    1'.1 !escribe the purpose of the main steps in the physical desi"n methodolo"y

    presented in this chapter.

    Step 8 designs the user vie!s for the database implementation$ Step @ designs the security

    mechanisms for the database implementation$ .his includes designing the access rules on the

    base relations$

    1'. !iscuss the difference between system security and data security.

    System securitycovers access and use of the database at the system level& such as a username

    and pass!ord$ !ata securitycovers access and use of database ob'ects (such as tables and

    vie!s) and the actions that users can have on the ob'ects$

    1'.& !escribe the access control facilities of S0L.

    Each database user is assigned an authori>ation identifierby the Database Administrator

    (D,A); usually& the identifier has an associated pass!ord& for obvious security reasons$ EveryS*+ statement that is executed by the D,-S is performed on behalf of a specific user$ .he

    authori#ation identifier is used to determine !hich database ob'ects that user may reference&

    and !hat operations may be performed on those ob'ects$ Each ob'ect that is created in S*+

    has an o!ner& !ho is identified by the authori#ation identifier$ ,y default& the o!ner is the only

    person !ho may no! of the existence of the ob'ect and perform any operations on the ob'ect$

    ,rivile"esare the actions that a user is permitted to carry out on a given base table or vie!$

    %or example& SELECTis the privilege to retrieve data from a table and UPDATEis the privilege

    to modify records of a table$ ?hen a user creates a table using the S*+ CREATE TABLE

    statement& he or she automatically becomes the o!ner of the table and receives full privileges

    for the table$ >ther users initially have no privileges on the ne!ly created table$ .o give them

    access to the table& the o!ner must explicitly grant them the necessary privileges using the

    S*+ GRANT statement$ A WITH GRANT OPTION clause can be specified !ith the GRANT

    statement to allo! the receiving user(s) to pass the privilege(s) on to other users$ 1rivileges can

    be revoed using the S*+ REVOKEstatement$

    @7

  • 8/11/2019 THOMAS M CONNOLLY & CAROLYN E BEGG : DB Questions

    65/82

    Database Solutions (2ndEdition)

    ?hen a user creates a vie! !ith the CREATE VIEW statement& he or she automatically

    becomes the o!ner of the vie!& but does not necessarily receive full privileges on the vie!$ .o

    create the vie!& a user must have SELECTprivilege to all the tables that mae up the vie!$

    3o!ever& the o!ner !ill only get other privileges if he or she holds those privileges for everytable in the vie!$

    1'.& !escribe the security features of )icrosoft ?ccess BB.

    Access provides a number of security features including the follo!ing t!o methods:

    (a) setting a pass!ord for opening a database (system security);

    (b) user/level security& !hich can be used to limit the parts of the database that a user can

    read or update (data security)$

    9n addition to the above t!o methods of securing a -icrosoft Access database& other security