Beruflich Dokumente
Kultur Dokumente
EXAMINATION PAPER:
Campus
Maritime Greenwich
School
Department
Level
Three
TITLE OF PAPER
COURSE CODE
COMP1302
BAHRAIN
GREECE
KENYA
MALAYSIA
MALAWI
MYANMAR
SAUDI ARABIA
SRI LANKA
SYRIA
TRINIDAD
ZAMBIA
15:00
15:00
15:00
18:30
14:00
16:30
15:00
17:30
15:00
09:30
14:00
BOTSWANA
HONG KONG
LONDON
MALTA
MAURITIUS
RWANDA
SINGAPORE
SOUTH AFRICA
TANZANIA
VIETNAM
BANGLADESH
14:00
18:30
13:00
14:00
16:00
14:00
17:30
14:00
15:00
18:30
18:30
FINAL
1.
Section A (Compulsory)
1.
(a)
W
hat are the roles of the Database Administrator (DBA)?
[8 marks]
(b) State the first two of the four main phases of query processing and briefly describe
what should happen in each phase identified.
[8 marks]
(c)
D1
P2
D2
P3
D3
P4
D4
L1
L2
L3
L4
Location
Figure 1
(i)
(ii) From the given occurrences diagram, list the departments that have
more than one employee working in it.
[1 mark]
(iii) From the given occurrences diagram, identify the degree of the
WorksIn relationship.
[1 mark]
(iv) Using the Chen or UML notation, draw an Entity Relationship
diagram showing the WorksIn relationship and the three entity types
Person, Department and Location. Include the cardinality and
participation constraints on your diagram. DO NOT show any
attributes on the diagram.
[5 marks]
COMP1302 Database Design and Implementation
Page 2 of 10
FINAL
(d)
Th
e relational structure in Figure 2 below captures a snapshot of the database tables of
a small estate agent database. A branch must have a manager and may have many
staff working in it. A member of staff can work in one branch only.
Staff
staffNo
SA9
SG14
SG37
SG5
SL21
SL41
SG66
fName
Mary
David
Ann
Susan
John
Julie
Ahmed
lName
Howe
Ford
Beech
Brand
White
Lee
Mansoor
Branch
branchNo
B002
B003
B004
B005
B007
position
Assistant
Supervisor
Assistant
Manager
Manager
Assistant
Manager
street
56 Cover Drive
163 Main Street
32 Manse Road
22 Deer Road
16 Argyll Street
sex
F
M
F
F
M
F
M
DOB
19/02/1970
24/03/1958
10/11/1960
03/06/1940
01/10/1945
13/06/1965
19/08/2003
city
London
Glasgow
Bristol
London
Aberdeen
salary
9000
18000
12000
24000
30000
9000
35000
branchNo
B007
B003
B003
B003
B005
B005
B007
postcode
NW10 6EU
G11 9QX
BS99 1NZ
SW1 4EH
AB2 3SU
Figure 2A snapshot of the database tables for a small estate agent database
(i)
Provide the output when the SQL code below is run against the
database snapshot.
[4 marks]
SELECT city, postcode
FROM Branch
WHERE branchNo NOT IN
(SELECT distinct branchNo FROM Staff);
(ii)
[4 marks]
FINAL
(e)
O
nly FOUR of the following statements are true. Write down the numbers of the
FOUR statements you believe to be true. Only the FOUR first answers will count.
DO NOT COPY ANY of the statements to your answer book.
[8 marks]
(i)
A relational view that is produced from two base tables chosen from a
fully normalised relational schema is always in 3NF.
(ii)
(iii)
(iv)
(v)
(vi)
(vii)
(viii) Classification is one of the methods used in data mining to search for
hidden knowledge.
(ix)
(x)
FINAL
Section B (Answer and TWO questions)
2. The relational structure in Figure 3 below captures a snapshot of the database tables of
a Musical database. The stored information is about Artists and Music. One artist can
have one or many albums and an album can have one or many artists related to it. An
album can be a compilation of many artists. The Artist table consists of only the Artist
ID and the Artist Name (Full name). The Album table consists of the Album ID,
Album (or Single) name, the Genre ID (lookup to the Genre table), the Label ID
(lookup to the Label table) and the Album Release Date.
Part of the relational schema of the Music database is shown in Figure 4 on the
following page. The primary key for each table is underlined. The relationships
diagram for this relational schema is also presented below in Figure 5.
tblAlbum
lngAlbumID
2
3
4
5
6
7
9
10
11
strAlbumName
lngGenreID lngLabelID dteAlbumReleaseDate
Now That's What I Call Music! Vol. 52
6
1
22/07/2002
Heathen Chemistry
2
2
01/07/2002
Fever
1
3
01/10/2001
The Best Bands in the World...Ever
6
4
04/11/2002
Reloaded Vol.4
5
5
21/01/2002
The Joshua Tree
1
6
01/03/1987
The Eminem Show
7
7
27/05/2002
The Marshall Mathers LP
7
7
11/09/2000
Forget About Dre [CD Single]
7
7
29/05/2000
tblLabel
tblArtist
tblLINKArtist_Album
lngLabelID strLabelName
1
EMI
2
Big Brother
3
Parlophone
4
Virgin TV
5
Universal Music TV
6
Island
7
Interscope
lngArtistID strArtistName
1
U2
2
Kylie Minogue
3
Oasis
4
Moby
5
Stereophonics
6
Eminem
7
Dr Dre
lngArtistID lngAlbumID
1
6
1
7
2
2
2
4
3
3
3
5
4
2
4
5
5
2
5
6
6
9
6
10
6
11
7
11
tblGenre
lngGenreID strGenreDescription
1
POP
2
ROCK
3
PUNK
4
EASY LISTENING
5
COUNTRY
6
COMPILATION
7
RAP/HIP HOP
8
DANCE
FINAL
A set of applications has been planned against the database. You have been
asked to express the following requests in SQL. Referential integrity (cascade,
delete & update) is maintained automatically by the system.
(i) The rock & roll band Oasis had a new manager just before June 2002. The
manager decided to delay the release of all new albums until the Christmas
season of that year (i.e. beginning of December 2002). However, the database
was not updated at the time. You have been asked to update the dates for all
albums released by that group during that period (i.e. between 1/6/2002 and
31/11/2002).
[5 marks]
(ii) For each album that was produced by more than one artist, list the name of the
album and the total number of artists associated with it.
[5 marks]
(iii) Produce a list of artist names and the total number of Albums that each artist
produced before 2002.
[5 marks]
COMP1302 Database Design and Implementation
Page 6 of 10
FINAL
(b)
Another set of applications has been already coded in SQL. For each of the
given SQL code statements 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. Ignore any data modification that might have resulted from executing
the SQL statements that you have produced in section (a) above.
Note: The function DatePart("yyyy", fieldname) filters the four-digit year of
the value of the referenced field.
(i) SELECT G.strGenreDescription as Genre, count(A.lngGenreID) as Total
FROM tblAlbum A, tblGenre G
Where DatePart("yyyy", A.dteAlbumReleaseDate) = 2002 And
A.lngGenreID =G.lngGenreID
Group by G.strGenreDescription;
[3 marks]
[3 marks]
[3 marks]
FINAL
3.
(a)
T
he relational schema below represents a simple family model where a record of a
person and his father and mother is stored. A person is allocated a unique social
security number (SSN), his/her full name (FName), Gender, Date of Birth (DoB),
and a unique identifier of his/her father and his//her mother. A person may have
children but must have a father and a mother.
FName
Gender
SSN
DOB
Father_of
Person
N
Mother_of
Map the above Relational Schema into one Relational table. Do not add additional
attributes to the list. Underline the primary key and identify any foreign keys by
drawing an arrow from each foreign key pointing to the referenced primary key. Do
not add any additional attributes.
[10 marks]
(b)
Modify the diagram to present a marriage scenario. A person may marry one
person of the other opposite sex at one time. For each person a record of the marital
status must be maintained. These include Single, Married, Divorced, or a Widowed.
A widow is single person whose spouse has deceased. A person with a married
status cannot marry again until he/she gets a divorce. Historical records of previous
marriages or divorces must be maintained by recording the relevant date (e.g. one
can retrieve partners identities and date of previous marriages of any given
person). Reproduce the diagram above to include this scenario.
[10 marks]
(c)
Map your diagram into a relational schema. Underline the primary key and
identify any foreign keys by drawing an arrow from each foreign key pointing to
the referenced primary key. Do not add any additional attributes.
[10 marks]
FINAL
4)
4)
(a) Integrity is a feature of a DBMS. Consider the following scenario: An investment
company operates out of a single office in Hong Kong. Its business is based on
many years of high quality service, honesty, and reliability. The CEO (Chief
Executive Officer) is concerned that the firm has become too dependent on its
computer system. If some disaster should occur and the firms databases were lost,
its reputation for reliability would disappear overnight along with many of its
customers in the highly competitive business.
Discuss what you think the firm should do to ensure database integrity.
[10 marks]
(b)
Transaction B
(i)
What are the actual final values resulting from the above sequence
when transactions A and B are executed in an interleaved manner?
Show how you calculated your results.
[5 marks]
(ii)
FINAL
(c)
Identify the type of problem in each of the two transaction schedules presented
below. Justify your answer.
(i)
[5 marks]
(ii)
[5 marks]