Professional Documents
Culture Documents
Level Three
Answer TWO questions from the remaining THREE questions, questions 2 to 4 which are
worth 30 marks each. If you answer all THREE questions from questions 2 to 4, marks will
ONLY be awarded for your TWO best answers.
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) Consider the diagram in Figure 1 below which shows occurrences of the
WorksIn relationship connecting occurrences of the entity types Person,
Department and Location.
.
Person Department
WorksIn
P1
D1
P2
D2
P3
D3
P4
D4
L1
L2
L3
L4 Location
Figure 1
(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]
(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 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 estate agent database
(i) Provide the output when the SQL code below is run against the
database snapshot. [4 marks]
(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.
(v) Executing the same program several times will generate several
transactions.
(vii) A multilevel, B+ index supports both sequential and direct access to the
rows of a table.
(viii) Classification is one of the methods used in data mining to search for
hidden knowledge.
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 strAlbumName lngGenreID lngLabelID dteAlbumReleaseDate
2 Now That's What I Call Music! Vol. 52 6 1 22/07/2002
3 Heathen Chemistry 2 2 01/07/2002
4 Fever 1 3 01/10/2001
5 The Best Bands in the World...Ever 6 4 04/11/2002
6 Reloaded Vol.4 5 5 21/01/2002
7 The Joshua Tree 1 6 01/03/1987
9 The Eminem Show 7 7 27/05/2002
10 The Marshall Mathers LP 7 7 11/09/2000
11 Forget About Dre [CD Single] 7 7 29/05/2000
(a) 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]
(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.
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
1 Person 1 Mother_of
Father_of
N N
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]
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 firm’s 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]
Transaction A Transaction B
Read ACC1 record and lock
Reduce balance by 500
Write balance & Release lock
Read account ACC1 and lock
Update balance by 100%
Write ACC1 & Release lock
Read ACC2 record and lock
Update balance by 100%
Write balance & Release lock
Read account ACC2 and lock
Increase balance by 100%
Write ACC2 & Release lock
(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) What should be the final balance value if the transactions were
performed serially? Show how you calculated your results.
[5 marks]
(c) Identify the type of problem in each of the two transaction schedules presented
below. Justify your answer.
(i) [5 marks]
(ii) [5 marks]