You are on page 1of 7

APPROVED

EXAMINATION PAPER: ACADEMIC SESSION 2008/2009

Campus Maritime Greenwich

School Computing and Mathematical Sciences

Department Information System and Multimedia

Level Three

TITLE OF PAPER Database Design & Implementation

COURSE CODE COMP1302

Date 27th May 2009

Duration 2 Hours

BAHRAIN 15:00 BOTSWANA 15:00


GREECE 15:00 HONG KONG 18:30
KENYA 16:00 LONDON 13:00
MALAYSIA 18:30 MALTA 14:00
MALAWI 14:00 MAURITIUS 18:00
MYANMAR 15:30 RWANDA 14:00
SAUDI ARABIA 16:00 SINGAPORE 17:30
SRI LANKA 18:30 SOUTH AFRICA 15:00
SYRIA 14:00 TANZANIA 16:00
TRINIDAD 09:30 UAE 17:00
ZAMBIA 15:00

You MUST answer question 1 from Section A which is worth 40 marks


AND TWO questions from section B which are worth 30 marks each.

If you answer more than two questions from section B, marks will ONLY be awarded for
your TWO best answers.

CALCULATORS AND ELECTRONIC DEVICES ARE NOT PERMITTED


APPROVED

Section A (Compulsory)

1. (a) Consider the diagram in Figure 1 below which shows occurrences of the
Manage and Located_In relationships connecting occurrences of the entity
types Person, Department and Location.

Person Department
Manage
P1
D1
P2
D2
P3
D3
P4
Located_In
P5
Location
P6
L1

P7
L2

L3

Figure 1

From the given occurrences diagram:

(i) State the number of occurrences of the Manage relationship.


[1 mark]

(ii) Identify the degree of the Manage relationship.


[1 mark]

(iii) Identify the cardinality of the Located_In relationship.


[2 marks]

(iv) State the participation constraints of the Person-Manage-Department


relationship from both ends.
[2 marks]

(v) From the given occurrences diagram, list the departments that are located
at location “L1”.
[2 marks]

Question 1 is continued on the following page.

Database Design & Implementation


COMP1302
Page 2 of 7
APPROVED

Question 1 continued.
(b) Derive a set of well-normalized tables for the following functional
dependencies between these attributes:
fd1: branchNo Æ branchAddress
fd2: branchNo, customerSerialNo Æ creditCode
fd3: customerSerialNo Æ customerAddress
fd4: creditCode Æ creditLimit
Express your answer as a determinacy diagram and in the form of relational
tables in 3NF with each table identifier underlined.
[8 marks]

(c) Compare and contrast dynamic query optimisation versus static query
optimisation.
[8 marks]

(d) The relational structure in Figure 2 below captures a snapshot of the database
tables of a small company database. A branch must have a manager and many
staff may work in it. A staff member can work in at most one branch.

Staff
staffNo fName lName position sex DOB salary branchNo
SA9 Mary Howe Assistant F 19/02/1970 9000 B007
SG14 David Ford Supervisor M 24/03/1958 18000 B003
SG37 Ann Beech Assistant F 10/11/1960 12000 B003
SG5 Susan Brand Manager F 03/06/1940 24000 B003
SL21 John White Manager M 01/10/1945 30000 B005
SL41 Julie Lee Assistant F 13/06/1965 9000 B005
SG66 Ahmed Mansoor Manager M 19/08/2003 35000 B007

Branch
branchNo street city postcode
B002 56 Cover Drive London NW10 6EU
B003 163 Main Street Glasgow G11 9QX
B004 32 Manse Road Bristol BS99 1NZ
B005 22 Deer Road London SW1 4EH
B007 16 Argyll Street Aberdeen AB2 3SU

Figure 2—A snapshot of the database tables for a small company database

(i) Provide the output when the SQL code below is run against the database
snapshot.
SELECT Position, Count(*) as Employees
FROM Staff
WHERE salary > 12000 and sex ='M'
Group by Position;
[4 marks]

Question 1 continued on the following page.

Database Design & Implementation


COMP1302
Page 3 of 7
APPROVED

Question 1 continued.

(ii) Express the following request in SQL:


List the city and the post code for all branches with no working.
[4 marks]

(e) Only FOUR of the following statements are true. Write down the numbers of
the FOUR statements you believe to be true.
DO NOT COPY ANY of the statements to your answer book.
[8 marks]

(i) The Theta-join applied to two relations produces the same output as
applying the Cartesian product on the two relations.

(ii) Row level locking is technically quite difficult to implement and hence
page level locking is used as a compromise.

(iii) Relational Algebra is a set-oriented language in which all tuples, possibly


from different relations, are manipulated in one statement without
looping.

(iv) In Pessimistic locking, it is necessary to ascertain, at the point of


committing the transaction, that no other transaction has accessed the
same data.

(v) All 3rd Normal Forms relation that are based on a composite primary key
are in Boyce-Codd normal form.

(vi) A clustering index is usually specified on the non-ordering, non-unique


field of a file.

(vii) Cascade deletion means a row from the parent relation is deleted when an
associate row is deleted from another child relation.

(viii) A foreign key in a relation may not be unique.

(ix) ODBC was created to enable connections to relational databases and


other table-like sources.

(x) A composite object can be represented by a single relation.

NOTE: If you write down more than FOUR statement numbers in your answer
book then the FIRST FOUR will be taken as your answer.

Database Design & Implementation


COMP1302
Page 4 of 7
APPROVED

Section B (Answer any TWO questions)

2. The relational structure below captures a snapshot of the database tables of part of a
library system. The library has many branches. A book can be written by more than
one author and an author can write many books. A book has only one title but
different books can share the same title. Each branch holds a number of copies of a
book. The primary key for each table is underlined. That is, for the Author table the
primary key is AuthorName, for the Branch table it is BranchId, for the Book table it
is Id, for the BookAuthor table it is the composite key (BookId, AuthorName), and
for the BookCopies table it is the composite key (BookId, BranchId). The
relationships diagram for this relational schema is also presented below.

Author BookAuthor
BookId AuthorName
AuthorName Country
AW12 Date CJ
Date CJ England
Folk M France
AW14 Folk M BooKCopies
AW14 Riccardi Greg BookId BranchId NumCopies
Korth Poland
MH123 Korth AW12 DSL 2
Riccardi Greg Italy
MH123 Silberschatz AW14 Main 3
Silberschatz USA
MH123 Sudarshan PH10 DSL 1
Sudarshan Canada
PH10 Ullman Jeff PH10 NW 3
Ullman Jeff USA
PH10 Widom J
Widom J USA
Book
Branch
Id Title Publisher
BranchId BranchName Address
AW12 Database Systems Addison Wesley
DSL Dirac Woodword Ave
AW14 File Structures Addison Wesley
Main Strozier Palmetto St.
MH123 First Course in Database Systems McGraw Hill
NW Northwest US 319
PH10 Database Systems Prentice Hall

(a) A set of applications has been planned against the database. You have been
asked to express the following queries in SQL (Structured Query Language).

(i)For each branch and a publisher, list the name of the branch, the name of
the publisher and the total number of copies of all books in the branch
published by a particular publisher.
[5 marks]
Question 2 is continued on the following page.

Database Design & Implementation


COMP1302
Page 5 of 7
APPROVED

Question 2 continued.
(ii) Add two more copies to any book stored at Woodword Ave branch.
[5 marks]

(iii) All books published by Addison Wesley have been removed from all
branch libraries. Update the database.
[5 marks]

(b) Another set of applications has been already coded in SQL. For each of the
given section of SQL code below produce the output using the data from the
above tables. Present your answer in a table format using column headers as
they appear in the query.

(i) SELECT title


FROM book
GROUP BY title HAVING count (title) > 1;
[3 marks]
(ii) SELECT DISTINCT Publisher
FROM Branch AS BH, BookCopies AS BC, Book AS BK
WHERE BH.BranchName='Strozier' And
BH.BranchId=BC.BranchId And
BC.BookId=BK.Id;
[3 marks]
(iii) SELECT BookId, Title
FROM Book, BookAuthor BA, Author
WHERE Id=BookId and BA.AuthorName=Author.AuthorName
GROUP BY BookId, Title HAVING count(*) > 2;
[3 marks]
(iv) SELECT id, title
FROM book
WHERE Id NOT IN (SELECT bookid FROM bookcopies);
[3 marks]
(v) SELECT Branch.BranchName, Branch.Address
FROM Branch , BooKCopies
WHERE Branch.BranchId = BooKCopies.BranchId and
BooKCopies.NumCopies=3;
[3 marks]

3. (a) Explain in detail how a Dimensional Model (DM) differs from an Entity–
Relationship (ER) Model.
[15 marks]

(b) Compare and contrast Optimistic Locking and Pessimistic Locking.


[15 marks]

Database Design & Implementation


COMP1302
Page 6 of 7
APPROVED

4. (a) What is semistructured data? Discuss the difference between semistructured


and structured data. Give examples to illustrate your answer.
[10 marks]

(b) Discuss how XML can be transferred into a database.


[10 marks]

(c) Explain the concepts of serial, non-serial, and serializable schedules. State the
rules for equivalence of schedules.
[10 marks]

Database Design & Implementation


COMP1302
Page 7 of 7

You might also like