Sie sind auf Seite 1von 14

Answer pointers

SAMPLE EXAMINATION PAPER

INFO2403 – Database Design and Implementation

Note that solutions are indicative.

Alternative, equally valid, solutions will be accepted.

Time Allowed: 2 HOURS

Rubric as it will appear on the examination paper:

Attempt ALL questions in Section A and Section B


and
ONE question from Section C

Section A is worth 40 of the available marks.


Answer Section A on this paper and hand it in with your answer book.

Section B is worth 40 of the available marks.


Answer Section B in your examination answer book.

Each question in Section C is worth 20 marks. Answer ONE question


from this section in your answer book

An Appendix is attached and should be used when answering questions A5-A12.

It is important to write your course and student number


in the space provided above.

CANDIDATES MUST NOT REMOVE THIS EXAMINATION PAPER FROM


THE EXAMINATION ROOM BUT MUST HAND IT TO THE INVIGILATOR
AT THE END OF THE EXAMINATION

Page 1
Answer pointers

Section A

Answer Section A on this paper and hand it in with your answer book.
Attempt ALL questions in this section.

A1. State TWO advantages of using a database for data storage, as


compared with using an ‘application-centred’ or ‘file-based’ approach.
(2 marks)

Sharing data
Control of redundancy
Improved data integrity
Enforced integrity constraints
Improved security
Increased concurrency
Multiple interfaces
Faster development
Increased flexibility

See Ward (2008), Chapter 1


Lecture notes for week 23; also Lecture 2 in week 1

Up to 1 mark for each correct advantage

A2. Using an example, define the term referential integrity and explain why
it is important to enforce it.
(4 marks)
A foreigh key value must occur as a primary k ey value in another
table or be null.

See Ward (2008), pp 22-23 & 99-100


Lecture notes for week 22

Up to 2 marks for definition with a suitable example

Up to 2 marks for correct explanation of importance of enforcing

Total = 4 marks

Page 2
Answer pointers

A3. Study the following table occurrence and answer the question that
follows:

Game_id Home_Team Away_Team Result


123 Poppleton Hampton Home win
126 Wigston Chantry Home win
119 Hampton Chantry Away Win

Give an example of:

An attribute type: column heading

An attribute occurrence: any value

A tuple: any row of data other than top row

A domain: a set of allowable values for an attribute any sewt of values


in a column

See Ward (2008), Chapter 2


Lecture notes for Lecture 2 in week 1

1 mark for each correct example

(4 marks)

A4. Decide whether the ‘Applicant’ table type below is in first normal form
(1NF). If it is in 1NF, explain why. If it is not in 1NF, explain why not
and take the necessary steps to put the data into 1NF.
(4 marks)

Applicants can apply for up to five courses. A unique number is


allocated to each applicant and details are stored of their name,
address, date of birth, any qualifications obtained together with the
grade and date obtained, and the identifying number of the courses
applied for.

APPLICANT (applicant_no, name, address, date_of_birth,


qualification_no, grade, date_obtained, course_no)

Not in 1NF – repeating group of coursenos

APPLICANT (applicant_no, name, address, date_of_birth,


qualification_no, grade, date_obtained, )

Application(applicant_no course_no)

See Ward (2008), Chapter 4


Data Modelling handout

Page 3
Answer pointers

Lecture notes for Lectures 6 & 7


Tutorial for week 5
Data Modelling coursework, etc.

1 mark for explanation; 1 mark for each correct table

Questions A5 to A12 refer to the model provided in the Appendix.

A5. Write down the enterprise rules represented by the ‘sponsors’


relationship between ‘Sponsor’ and ‘Exhibition’.
(2 marks)

See Ward (2008) Chapter 3


Data Modelling handout
Tutorials during Autumn term
Data Modelling coursework, etc.

A sponsor sponsors 0 or 1 exhibition


Each exhibition is sponsored by 0, 1 or more sponsors

I mark for each correct enterprise rule

A6. Show how you would represent the ‘sponsors’ relationship between
‘Sponsor’ and ‘Exhibition’ in a first level data model. .
(3 marks)
Sponsors(Sponsor_no, exhibition_no)
See Lecture notes for Lecture 9
Review lecture week 25

A7. An exhibition may contain more than one painting by the same artist.
Suppose that the name and other details such as date and place of
birth of the artist need to be stored.

Show how you would amend the model in the Appendix to meet this
requirement.

Make any amendments to the diagram by drawing on the ERD


provided in the Appendix and any additions/amendments to the tables
by writing them below: On diagram

Artist(Artist_No, DOB, Place_of_birth)

Artist_no in painting table as FK


(4 marks)

Page 4
Answer pointers

A8. Complete the following SQL statement so that it results in the


description of the painting(s) dated 1858 that are in exhibition no.
E5999:

SELECT description
FROM .painting.
WHERE
date_of_painting = 1858
AND
exhibition_no=’E5999’

..
(2 marks)

See SQL Trainer p. 2-4


Tutorial weeks 15 & 16
Labs weeks 15-18

A9. Complete the following SQL statement so that it results in a list of


visitor nos. of those visitors who visited the exhibition where the
painting with the description ‘Hay Wain’ was shown:

SELECT Visitor_no.
FROM visit, exhibition, painting
WHERE
Description=’Hay Wain’
AND
vist.visitor_no=exhibition.Visitor_no
AND
Exhibition.Exhibition_no=Paintiing.Exhibition_no;
...
(5 marks)

See SQL Trainer p. 2-10


Tutorial weeks 15 & 16
Labs weeks 15-18

Page 5
Answer pointers

A10. Complete the following SQL statement using a subquery so that it


results in the descriptions of the paintings that are in the same
exhibition as the painting with the description ‘The Kiss’:

SELECT . .description
FROM painting
Where exhibition_no in
(Select exhibition_no
From painting
Where description=’The Kiss’);
...
(5 marks)

See SQL Trainer p. 27-79


Lecture notes for week 18

A11. Complete the following SQL statement so that it finds the date of the
oldest painting shown in either exhibition no. E3500 or E5500:

SELECT .min(date_of_painting) . .
FROM painting
WHERE Exhibition_no in (‘E3500’,’E550’);
...
(4 marks)

See SQL Trainer p. 20-21


Lecture notes for week 17

A12. Complete the following SQL statement so that it shows the number of
visits made to each exhibition:

SELECT count(visitor_no), Exhibition_no


FROM Visit
Group by exhibition_no;
(4 marks)

See SQL Trainer p. 20-24


Lecture notes for week 17

(Total 40 marks)

Page 6
Answer pointers

Section B

This section is compulsory.


Answer it in your examination answer book.

B1. Read the following scenario carefully, then answer the questions that
follow it.

Oaklands Nursery
Oaklands Nursery grows plants in greenhouses and supplies them to shops.
Each plant species may have a number of varieties (e. g. if Rose is a species,
‘Summer Blush’ and ‘Yellow Sunburst’ are varieties of Rose). The Nursery allocates
a plant code to each plant species and keeps details of both its Latin name and its
popular name, together with a description. It also stores the price of each variety
and any growing notes that apply to a variety. The varieties are grown in batches;
each batch is of one variety but each variety may be grown in more than one batch.
The unique batch number, the date it was planted, in which greenhouse and the
date that it left the greenhouse to be sold are recorded.
Each greenhouse is normally in the charge of a gardener and it has a name,
a unique number and notes about the atmosphere (e.g. temperature, humidity)
inside it. A gardener may be responsible for more than one greenhouse. A
greenhouse can be empty (for example, while being repaired or refurbished), in
which case there will not be a gardener allocated to look after it. Details are stored
of each gardener’s name, address and mobile telephone number. Information is
also stored about the training courses that are available (the training course name
and description) and the date when a gardener attended a course. A new gardener
might not yet have attended any courses, but over time each gardener is expected
to attend several courses, and each course will have been attended by several
gardeners. The more senior gardeners are responsible for managing the less
experienced ones.
The name, address and telephone numbers of the shops that buy the
Nursery’s plants are stored. Each shop sends in regular orders; these may be for
many different varieties of plants. Each order is allocated a unique number, and a
note is made of the date it was received by the Nursery, the varieties ordered, and
the quantity required of each variety. Occasionally a shop makes a complaint about
the quality of a particular variety of plant supplied to them. The Nursery records
which order the complaint relates to and makes a point of tracing which gardener
was responsible for the relevant batch of plants.

(a) Draw an Entity-Relationship Diagram (ERD) for the Oaklands Nursery


scenario.
(20 marks)

(b) Derive well-normalised table types from your diagram. Clearly identify
all foreign keys.
(20 marks)

NOTE: If you find that you have to make any assumptions, state these
clearly. DO NOT state assumptions that contradict the scenario. DO NOT
re-state enterprise rules that are clearly specified in the scenario. DO NOT
add to the scenario. (Total 40 marks)

Page 7
Answer pointers

Page 8
Answer pointers

Page 9
Answer pointers

Oaklands Nursery

Sample Table Types:

Plant Species (plant_code, Latin_name, popular_name, description)


Variety (variety_code, variety_name, plant_code, growing_notes,
price)
Batch (batch_no, variety_code, greenhouse_no, date_planted,
date_removed)
Greenhouse (greenhouse_no, name, condition_notes)
Gardener (gardener_no, name, address, mobile)
Training Course (course_name, description)
Course Attendance (gardener_no, course_name, date_attended)
Shop (shop_no, shop_name, shop_address, shop_tel_no)
Order (order_no, date_received, shop_no)
Orderline (order_no, batch_no, quantity_required,
complaint_received [Boolean]1)

In_charge_of (greenhouse_no, gardener_no)


Manages (manager_gardener_no, supervised_gardener_no)

1
Alternatively: table for complaint.

Page 10
Answer pointers

Section C

Answer ONE question from this section.


Answer it in your examination answer book.

For this section: emphasize the need to write proper answers, with
clear explanations and providing full examples, where asked for.

C1. (a) Explain the concept of a ‘transaction’ in the context of database


management systems. With the aid of an example, explain the
properties of a transaction.

A logical Unit of Work- An action or series of actions which reads or


updates the contents of a database
Properties
Atomicity- all or nothing
Consistency- transforms DB from one consistent state to another
consistent state
Isolation- executes independently of other transactions
Durability- permanently recorded

(11 marks)

(b) Explain, using examples, three key problems that can arise when
there is concurrent multi-user access to a database.
Lost update two transactions running at the ‘same’ time on the same
piece of data the 2nd transaction to finish overwrites the update of first
Uncommitted dependency. A second transaction using the value
updated by a second value which then rollsback leads to incorrect
value.
Inconsistent analysis. When a transaction reads several values but a
2nd transaction updates one or more of these values part way through
the 1st transaction- really a scheduling problem
(9 marks)

See Ward (2008) Chapter 9


Lecture weeks 22 & 23
Tutorial week 25 & revision tutorial

Page 11
Answer pointers

C2. (a) Explain the role of the LOG and of CHECKPOINTS in recovery
from a failure affecting the main memory in a large, multi-user
database system.

Log records before and after image of the data for each
transaction as well as when the transaction was carried out.
Plus when a check point happens

Checkpoint forces buffer to write changes to secondary storage.

The recovery manager will use the log when there is a failure to
determine the last checkpoint
Transactions where changes were written to secondary storage
( ie they were completed before the checkpoint)- do nothing
Transactions that were finished since the checkpoint – they will
have a commit– roll forward ie redo from the before and after
images on the log
Transactions that were ongoing at the point of failure- no
commit therefore rollback
(12 marks)

(b) Examine the diagram below. Explain the action to be taken,


and why, by the Recovery Manager after the failure at time Tf.
(8 marks)

(Total 20 marks)

Time

Transaction 1

Transaction 2

Transaction 3

Transaction 4

Tc Tf
Checkpoint Failure

See Ward (2008) Chapter 10


Lecture week 24and 25

Page 12
Answer pointers

Revision tutorial

Transaction 1 rollback –not finished (no commit) so don’t know how much
more to do.
Transaction 2 completed before checkpoint ( shown by commit in log) so
changes permanently recorded on disk so do nothing
Transaction 3 and 4 finished before failure ( shown by commit in log) but after
checkpoint so not forced to disk. – using the after image redo the
transactions ie roll forward

Page 13
Answer pointers

Appendix

Draft Entity-Relationship Model for an Art Gallery


(diagram has solution to QA7)

Please note that this is a draft and the tables are NOT complete.

Sponsor (sponsor_no, sponsor_name, sponsor_address,


telephone_no, . . .)
Exhibition (exhibition_no, location, curator, . . .)
Visitor (visitor_no, visitor_name, visitor_address . . .)
Visit (visit_no, visitor_no, exhibition_no, date, entry-time, exit_time . . .)
Painting (painting_no, description, date_of_painting, exhibition_no . . .)

Required transactions include:


 Add a new exhibition.
 Record each visit made by a visitor.
 Find out the total number of visits made to a given exhibition
 Print out a list of who has sponsored which exhibitions.

Page 14

Das könnte Ihnen auch gefallen