You are on page 1of 10

APPROVED______________________________________________________________

EXAMINATION PAPER: ACADEMIC SESSION 2006/2007

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 and Time Friday 1st Dec 2006 3 Hours

London 13.30pm Bahrain 15.00pm


Hong Kong 18.00pm UAE 16.00pm
Trinidad 09.30pm Singapore 18.00pm
Malta 15.00pm Zambia 14.30pm
Malaysia 18.00pm Greece 15.00pm

You MUST answer question 1.


Marks will be awarded for your best THREE answers to the remaining FIVE questions.
If you answer more than THREE questions, marks will ONLY be awarded for your
THREE best answers.

Each question is worth 25 marks.


CALCULATORS AND ELECTRONIC DEVICES ARE NOT PERMITTED

Database Design and Implementation


COMP1302
Page 1 of 10
APPROVED
1. Write brief notes on the following topics using suitable examples whenever possible:

(a) Describe the architecture of a relational DBMS. If your Operating System (OS)
is upgraded to support some new functions on the OS files (e.g., the ability to
force some sequence of bytes to disk), which layer(s) or component(s) of the
DBMS would you have to rewrite to take advantage of these new functions?
[5 marks]

(b) Consider the diagram in Figure 1 below which shows occurrences of the
Works-In relationship: An Employee works in at most one department and at a
single location.

Departments D
Employees M D1

E1
Works-In D2
E2 WRK1
D3
E3 WRK2

E4 WRK3 Locations L
WRK3 L1

L2

L3

Figure 1

From the given occurrences diagram:

(i) State the number of occurrences of the Works-In relationship. [1 mark]

(ii) Identify the degree of the Works-In relationship. [1 mark]

(iii) Identify the location where employee E2 is working. [1 mark]

(iv) Identify all employees who work in location L2. [1 mark]

(v) Identify the department that has more than one employee. [1 mark]

(c) For the occurrence diagram in Figure 1 above, produce the Entity
Relationship Diagram. Identify the cardinalities and the participation
constraints for all relationships. Do not include any attributes on your
diagram. [5 marks]

Database Design & Implementation


COMP1302
Page 2 of 10
APPROVED

Q1 Continued
(d) The relational structure in Figure 2 below captures a snapshot of the
employee database table (EMP) for a small company. An employee may
manage other employees.
EMP
EMPNO EMPFNAME EMPSALARY DEPTNAME BOSSNO
1 Alice 75000 Management
2 Ned 45000 Marketing 1
3 Andrew 25000 Marketing 2
4 Clare 22000 Marketing 2
5 Todd 38000 Accounting 1
6 Nancy 22000 Accounting 5
7 Brier 43000 Purchasing 1
8 Sarah 56000 Purchasing 7
9 Sophie 35000 Personnel & PR 1
Figure 2

(i) Provide the output when the Structured Query Language (SQL) code
below is run against the database snapshot. [3 marks]

SELECT DISTINCT DEPTNAME FROM EMP


WHERE DEPTNAME <> 'Management'
AND DEPTNAME NOT IN
(SELECT WRK.DEPTNAME
FROM EMP WRK, EMP BOSS
WHERE WRK.BOSSNO = BOSS.EMPNO
AND WRK.EMPSALARY >= BOSS.EMPSALARY);

(ii) Express the following request in SQL. [2 marks]

For all employees who manage more than one employee, produce a list
of the manager number, his or her first name plus the number of
employees under that manager.

Database Design & Implementation


COMP1302
Page 3 of 10
APPROVED
Q1 Continued

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

(i) Not all queries written in SQL can be expressed in Relational Algebra or
Relational Calculus.

(ii) Transactions are interleaved to increase their integrity.

(iii) Recording the change in the log file before the change is truly made
indicates to the DB recovery mechanism to redo all the changes after
recovering from a system crash. F

(iv) Within an Enhanced ERD, an overlap constraint determines whether or


not two or more subclasses can contain the same entity instance.

(v) A web server is typically a middleware tier that is used to maintain a pool
of processes for handling client’s requests such as accessing database
systems.

(vi) The Recovery Manager ensures atomicity of transactions by undoing the


actions of transactions that do not commit.

(vii) The Recovery Manager ensures isolation by making sure that all actions
of committed transactions survive system crashes and media failures.

(viii) Application servers eliminate the problems with process creation


overload and can provide extra functionality like abstracting away
heterogeneous data sources.

(ix) Durability defines the persistence of uncommitted data. The data should
persist in the database even if the system crashes before the data is
written to non-volatile storage.

(x) Mandatory access controls do not distinguish between people in the same
clearance level so it is not possible to give only insert or select privileges
to different users in the same level.

Database Design & Implementation


COMP1302
Page 4 of 10
APPROVED
2. The relational structure in Figure 3 below captures a snapshot of the database tables
of the clearing system that is used to deal with students’ applications to different
schools at the UoG. The Database contains information on students and their
applications. Figure 4 represents the relationships diagram for this DB system.
A student application may be rejected or offered one or more places. The decision is
made by an academic staff and recorded in the DB. A student must provide
information on his/her qualifications and may supply reference information in
support of an application.
Student (sno, surname, otherNames, City, Dob, Sex);
Staff (staffno, surname, first_name, title, School);
Application (cen, propo_study_prog, level, stage, study_mode, status,
Decision, staffno, app_date, sno, Fee_Status);
Qualification (Qualification_id, Subject, Q_level, Year_awarded, Grade, sno);
Reference (ref_id, Ref_name, Title, Institution, Address, Tel_no, cen);

Application
study_
cen propo_study_prog level stage status Decision staffno app_date sno Fee_Status
mode
281 Computer Science BSc(Hons) 1 F/T Accepted Rejected 24 17/07/2006 11 Home
284 Mathematics BSc(Hons) 1 F/T AwaitingRef Processing 23 19/07/2006 15 Overseas
277 Multimedia BSc(Hons) 1 F/T Pending Offer made 22 16/08/2006 12 Home
282 Computer Science BSc(Hons) 1 F/T AwaitingRef Rejected 21 18/07/2006 13 Overseas
279 Computing HND 1 F/T Pending Offer made 21 23/07/2006 8 Overseas
278 Multimedia Technology BSc(Hons) 1 F/T Withdrawn Offer made 20 15/08/2006 12 Home
286 Computing HND 1 F/T Pending Offer made 19 17/07/2006 18 Overseas
283 Information System BSc(Hons) 1 F/T Offer made 19 17/08/2006 14 Overseas
285 Computing HND 1 F/T Pending Rejected 18 01/09/2006 16 Overseas
280 Information Systems BSc(Hons) 1 F/T Pending Rejected 18 23/08/2006 9 Overseas
288 Information Systems BSc(Hons) 1 F/T Pending Offer made 17 18/06/2006 20 Overseas
287 Computer Science BSc(Hons) 1 F/T Pending Offer made 17 16/06/2006 19 Overseas
270 Multimedia Technology BSc(Hons) 1 F/T Pending Offer made 17 14/06/2005 17 Home
274 Multimedia Technology BSc(Hons) 1 F/T Pending Offer made 16 08/08/2006 5 Overseas
273 Computer Science BSc(Hons) 1 F/T Offer made 16 23/07/2006 6 Overseas
275 Maths & Computing BSc(Hons) 1 F/T Accepted Offer made 15 23/08/2006 1 Overseas

Reference
ref_id Ref_name Title Institution Address Tel_no cen
199 David English Ms Westminister Kingsway college Battersea Park Road, London FW11 4JR 013225568000 270
200 Tall Dr Uplands Community college Wadhurst, East Sussex 017989278215 279
201 Ashly Prof Albany College Hendon 020720259656 281
202 Kevin Dell Mr Leyton 6th Form College Essex Road, London R6 6MW 013828928900 286
203 Simon Deer Mr Riddlesdown High Honister heights, Middlesdown, Surrey 077764534905 287
204 Raj Pollitt Mr Henley College Beanfield Ave, Oxfordshire 013715798867 287
205 Phiip Togher Dr Cooper Company Coborn School St Marys Lane, EM14 3HS 020782735677 277

Figure 3 —A snapshot of the database tables for the clearing database


(not all the data are displayed)

Database Design & Implementation


COMP1302
Page 5 of 10
APPROVED
Q2 Continued

Student Qualification
sno surname otherNames City Dob Sex Qualific Year_aw
Subject Q_level Grade sno
ation_id arded
1 Alatunji Auoola Glasgow 14/03/80 Male
67 English Literature GCSE 2000 C 1
5 Lahman Nazma Edinburgh 21/12/83 Female
129 French GCSE 1997 B 5
6 Dmyth- Jau Hayes 14/06/83 Male
Hutchind 1747 Business Studies AS 2002 D 6
8 Black Richard West Male 1748 Greek GCE 1999 A 8
Sussex 1749 Mathematics GCSE 2000 B 9
9 Patdiad George Cardiff 08/07/82 Male 1750 Double Science GCSE 1999 CC 11
11 Dhalna Devesh Middlesex 01/07/84 Male 146 Media Studies A D 12
12 Uptan Jenan Tenterden 22/06/72 Female 1751 Mathematics GCSE 2000 B 13
13 Awadeni Feni London 05/11/82 Male 196 English language GCSE A 14
14 Patel Jessy Glasgow 05/01/84 Female 811 IT AVCE 2002 CC 15
15 Paul Victor Hayes 30/11/83 Male 1752 English language GCSE 1989 B 16
16 Lablahari Mohammed Glasgow 12/05/84 Male 1753 Business Studies GCSE 1999 C 17
17 Daibu Hana Stratford 03/09/80 Female 1469 Computing HND Pass 18
18 Dandhu Sangeet Glasgow 28/8/80 Female 1745 Mathematics GCSE 1999 A 19
19 Umunna Victoria London 08/11/77 Female 1746 Media A 2002 D 20
Staff
staffno surname first_name title School
17 Ahmed Yami Mr CMS
16 Ayoob Ali Mr BIS
Figure 3 — Continued from previous page
18 Basim Arkan Mr BIS
24 Buket Fais Mrs CMS
15 Gerry David Dr CMS
23 Hill Munther Mr CMS
21 Omatoya Charli Dr MATH
19 Salmon Amown Dr CMS
20 Smith Eric Dr MATH
22 Wallis Barry Mr CMS

Figure 4 —A Relationship diagram for the clearing database

Database Design & Implementation


COMP1302
Page 6 of 10
APPROVED
Q2 Continued
(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) All pending offers made by Mr. Yami Ahmed for applications submitted
with references are accepted now. Update the DB.
[5 marks]
(ii) For all non pending applications give a list the student full name,
proposed study program, the status of his/her application and application
date. The list should be alphabetically sorted but the student’s surname.
[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 marks each]
(i) SELECT A.propo_study_prog, A.Decision,
Count(A.cen) as NumberOfAppl
FROM Application A, Student S
WHERE S.sno = A.sno AND
A.Decision in ("Rejected" , "Processing")
GROUP BY A.propo_study_prog, A.Decision;
(ii) SELECT s.first_name+" "+s.surname AS StaffName, St.sno AS
StudentNo, A.propo_study_prog AS ApplyFor, A.status
FROM Staff AS s, Student AS St, Application AS A, Qualification AS Q
WHERE Q.Subject='Mathematics' AND Q.sno=St.sno AND
St.sno=A.sno AND A.staffno=S.staffno;
(iii) SELECT A.Fee_Status, St.Sex, Count(St.Sex) AS NoOfStudents
FROM Student AS St, Application AS A
WHERE St.sno=A.sno
GROUP BY A.Fee_Status, St.Sex;
(iv) SELECT S.School, Count(A.Decision) as numberOfOffer
FROM Staff AS s, Application AS A
WHERE S.Staffno=A.Staffno AND A.decision='Offer made'
GROUP BY S.School
HAVING COUNT(*) > 1;
(v) SELECT St.sno, St.otherNames+" "+St.surname as StudentFullName
FROM Student AS St, Application AS A, Reference R
WHERE St.sno=A.sno AND A.cen = R.cen
GROUP BY St.sno, St.otherNames, St.surname
HAVING COUNT(R.cen) > 1
ORDER BY St.sno ;

Database Design & Implementation


COMP1302
Page 7 of 10
APPROVED

3. There are a number of considerations that guide your choice in creating an index for a
relation. Discuss each of the following issues?

(a) The choice of the primary index. [5 marks]

(b) Clustered versus Un-Clustered indexes. [5 marks]

(c) Hash versus tree indexes. [5 marks]

(d) The use of a sorted file rather than a tree-based index. [5 marks]

(e) Choice of composite search key for the index. What are index-only plans, and
what is the influence of potential index-only valuation plans on the choice of
search key for an index?
[5 marks]

4. (a) Does the relational model, as seen by an SQL query writer, provide physical
and logical data independence? Explain. [5 marks]

(b) Give a set of Functional Dependencies (FDs) for the relation schema
R(A,B,C,D) with primary key AB under which R is in:
(i) 1NF but not in 2NF. Justify your answers. [5 marks]

(ii) 2NF but not in 3NF. Justify your answers. [5 marks]

(c) Discuss the strengths and weaknesses of the trigger mechanism. Contrast
triggers with other integrity constraints supported by SQL.
[10 marks]

Database Design & Implementation


COMP1302
Page 8 of 10
APPROVED

5. (a) A multinational engineering company has decided to distribute its project


management information at the regional level in mainland Britain. Figure 5
shows the conceptual schema for the system.

Figure 5 ERD for the Company DB (Using Crow’s foot notation)

The current centralized relational schema is as follows:


Employee (NIN, fName, lName, address, DOB, sex, salary, taxCode, deptNo)
Department (deptNo, deptName, managerNIN, businessAreaNo, regionNo)
Project (projNo, projName, contractPrice, projectManagerNIN, deptNo)
WorksOn (NIN, projNo, hoursWorked)
Business (businessAreaNo, businessAreaName)
Region (regionNo, regionName)

Where
Employee contains employee details and the national insurance number NIN is the key.
Department contains department details and deptNo is the key. managerNIN identifies the
employee who is the manager of the department. There is only one manager for each
department.
Project contains details of the projects in the company and the key is projNo. The project
manager is identified by the projectManagerNIN, and the department responsible for
the project by deptNo.
WorksOn contains details of the hours worked by employees on each project and (NIN,
projNo) forms the key.
Business contains names of the business areas and the key is businessAreaNo. And
Region contains names of the regions and the key is regionNo

Departments are grouped regionally as follows:


Region 1: Scotland; Region 2: Wales; Region 3: England

Information is required by business area which covers: Software Engineering,


Mechanical Engineering and Electrical Engineering. There is no
Software Engineering in Wales and all Electrical Engineering
departments are in England. Projects are staffed by local department
offices.

Database Design & Implementation


COMP1302
Page 9 of 10
APPROVED
Q5 Continued
As well as distributing the data regionally, there is an additional requirement to
access the employee data either by personal information (by Personnel)
or by work related information (by Payroll).
Produce a distributed database design for this system, and include:

(i) a suitable fragmentation schema for the system; [10 Marks]


(ii) in the case of primary horizontal fragmentation, a minimal set of
predicates resented in Relational Algebra or SQL; [5 Marks]
(iii) the reconstruction of global relations from fragments. [5 Marks]

State any assumptions necessary to support your design.

(b) With respect to the DB recovery mechanism, what is the difference between a
system crash and a media failure? [5 marks]

6. (a) It has been argued recently that “it is also correct to consider an XML
document as being a sort of database storage, in a broad sense”. Evaluate the
above statement and give your opinion. Your discussion should include an
assessment of the arguments for and, against the statement, and be supported
by making reference to example applications.
[17 Marks]

(b) Integrity is one of the important features 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 briefly what you think the firm should do to ensure database integrity.
[8 Marks]

Database Design & Implementation


COMP1302
Page 10 of 10

You might also like