Beruflich Dokumente
Kultur Dokumente
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.
Sharing data
Control of redundancy
Improved data integrity
Enforced integrity constraints
Improved security
Increased concurrency
Multiple interfaces
Faster development
Increased flexibility
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.
Total = 4 marks
Page 2
Answer pointers
A3. Study the following table occurrence and answer the question that
follows:
(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)
Application(applicant_no course_no)
Page 3
Answer pointers
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.
Page 4
Answer pointers
SELECT description
FROM .painting.
WHERE
date_of_painting = 1858
AND
exhibition_no=’E5999’
..
(2 marks)
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)
Page 5
Answer pointers
SELECT . .description
FROM painting
Where exhibition_no in
(Select exhibition_no
From painting
Where description=’The Kiss’);
...
(5 marks)
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)
A12. Complete the following SQL statement so that it shows the number of
visits made to each exhibition:
(Total 40 marks)
Page 6
Answer pointers
Section B
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.
(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
1
Alternatively: table for complaint.
Page 10
Answer pointers
Section C
For this section: emphasize the need to write proper answers, with
clear explanations and providing full examples, where asked for.
(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)
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
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)
(Total 20 marks)
Time
Transaction 1
Transaction 2
Transaction 3
Transaction 4
Tc Tf
Checkpoint Failure
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
Please note that this is a draft and the tables are NOT complete.
Page 14