You are on page 1of 9

EXAMINATION PAPER: ACADEMIC SESSION 2007/2008

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 Tuesday 27th May 2008 (2 hours)

BAHRAIN – 15:00 SINGAPORE – 18:30


GREECE – 15:00 SYRIA – 15:00
HONG KONG – 18:30 TRINIDAD – 09:30
LONDON – 13:00 UAE – 16:00
MALAYSIA – 18:30 ZAMBIA – 15:00
MALTA – 15:00

You MUST answer question 1 which is worth 40%.

Marks will be awarded for your best TWO answers to the remaining THREE questions.
Each question is worth 30% marks.

CALCULATORS AND ELECTRONIC DEVICES ARE NOT PERMITTED


APPROVED

1. (a) What are the Database Administrator (DBA) ? List three of them with brief
explanations.
If we assume that the DBA is never interested in running his or her own
queries, does the DBA still need to understand query optimisation? Justify your
answer.
[8 marks]
(b) 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

L1

L2

L3

Location
Figure 1

(i) State the number of occurrences of the WorksIn relationship. [1 mark]

(ii) From the given occurrences diagram, identify the degree of the WorksIn
relationship. [1 mark]

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

(iv) From your answer to (iii) and given the further requirement that a
Department must have a location and at least one employee working in it,
draw an Entity Relationship diagram showing the WorksIn relationship
between the three entity types Person, Department and Location,
including the cardinality and participation constraints. DO NOT show
any attributes on the diagram. [4 marks]

(c) A newsagent’s shop is one in a chain of 500 shops that is part of a national
company. Each shop typically offers for sale supplies of twelve daily newspapers,
six Sunday papers with supplements, and eighty monthly magazines. Each shop
holds details of each newspaper or magazine on the computer in a flat file with
fixed length records. Some titles are shared between newspapers and magazines.
For each of the following sections, write down the letter corresponding to the

Marking Schema for Database Design & Implementation


COMP1302
Page 2 of 9
APPROVED

statement you believe to be true. DO NOT COPY the statement to your answer
book.
(i) At each shop and for each record in the above file a two-character code
representing the title is introduced to speed up processing. This code should
be defined as:
(a) Required and Unique for each newspaper or magazine.
(b) Required but Not Unique for each newspaper or magazine.
(c) Required and Unique for each newspaper but not for magazine.
(e) Required and Unique for each magazine but not for newspaper.
[1 mark]

(ii) The manager of each shop evaluates various specialized packages and
Database management systems for the running of a newsagent’s shop. All
mangers agree to purchase a Relational Database management system. The
advantage of using the DBMS rather than a tailor-made software package in
the running of a newsagent’s shop:
(a) is readily available and has large user-base.
(b) has built-in facilities that satisfy the newsagent’s shop.
(c) incurs no extra cost for building the system.
(d) is already tested and customized.
[1 mark]
(iii) The newsagent’s shop has between 100 and 500 customers who have
accounts. These customers have papers delivered and magazines ordered
regularly. Their individual accounts are payable weekly. A customer who
order many newspapers and magazines, get them delivered in the
appropriate round. The newsagents update their filing system to use a
relational database. Potential entities are Customer, Newspaper, Account
and Round. The relationship between Customer and Newspaper tables
would be:
(a) 1:1 (b) 1:N (c) N:1 (d) M:N
[2 marks]

(iv) In the relational schema for the above application, Account_ID should
appear in which table(s)?
(a) Account Table (b) Customer Table
(c) In all tables of the database (d) Both (a) and (b)
[2 marks]
(v) The newsagent is part of a national company that runs 500 shops. Its local
server is connected to a computer network at the company’s head office. At
the end of each day, sales data is transferred electronically to the head office
computer. When the data has arrived from all of the shops, the head office
computer runs a routine to update its master files. The major characteristic
of this type of processing is, it:
(a) has large volume of similar transactions.
(b) has large volume of different types transactions.
(c) requires human interaction as data entry clerks.
(d) can commence processing once part of the data ready.
[2 marks]

Marking Schema for Database Design & Implementation


COMP1302
Page 3 of 9
APPROVED

(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 working in it. A staff can at most work in 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. [4 marks]
SELECT m.fname+" "+m.lname as Fullname
FROM staff AS m, staff AS e
WHERE e.fname ='Mary' AND e.lname='Howe' AND
e.staffno <> m.staffno AND e.branchno = m.branchno AND
m.position = 'Manager';

(ii) Express the SQL code below using a sub-query. [4 marks]

SELECT staffNo, fname, lname, position


FROM Staff s, Branch B
WHERE s.branchNo = b.branchNo AND city = 'London';

Marking Schema for Database Design & Implementation


COMP1302
Page 4 of 9
APPROVED

(e) Only FOUR of the following statements are true. Write down the numbers of
the FOUR statements you believe to be true ONLY. Identifying more than
FOUR true statements will result in awarding ZERO for all this section.
DO NOT COPY ANY of the statements to your answer book.
[8 marks]

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

(ii) Executing the same program several times is considered as a one


transaction.

(iii) Disallowing concurrent access of transactions can degrade application


performance.

(iv) Logical Data Independence is achieved through the separation of the two
abstraction levels defined in the conceptual & physical schemas.

(v) In an ERD, a fan trap may occur when 1:m relationships fan in from a
single entity.

(vi) Query optimization represents the activity of choosing an efficient


execution strategy for storing the final result of a query.

(vii) In Object Oriented DBMSs, object identifiers are used both by


application programs for referencing objects and for representing
relations between objects.

(viii) One of the fundamental strategies in query processing is to perform the


unary operations, Selection & Projections, as early as possible, thereby
reducing the operands of any subsequent binary operations.

Marking Schema for Database Design & Implementation


COMP1302
Page 5 of 9
APPROVED

2. The relational structure below, Figure 3, captures a snapshot of the database tables of
a medical research institute. Most patients’ information is kept in tblPatient but
sensitive information is kept in tblPtConfidential. Some patients have no confidential
information at all. Access to the information in tblPtConfidential could be more
restricted than for tblPatient. A patient may be covered by multiple insurance plans,
and an insurance company covers multiple patients. Figure 4 below shows the logical
data model for this DB.

tblInsurer
InsurerId CompanyName Address City State ZipCode Phone
678 Smith Sisters Co 908 Mockingbird Lane Ft. Myers FL 78989 8134567897
13909 First Insurance 3456 22nd Road Alexandria VA 22182 7039086543
45790 Total Health 8027 Leesburg Pike Flint MI 45980 3137899988

tblPtConfidential

PatientId LastName FirstName SocialSecurityNo Address City State ZipCode Phone


342 Litwin Tommy 345-56-2390 37 4th Street Cairo IL 42908 6187894567
345 Figure
Johnson3 —Matilda
A snapshot 456-09-8908
of the medical research DBAve
20 Farm Joplin MO 76890 4178908765
350 Cailente Kizzie 345-90-8769 4539 Brock St Camden NJ 10987 6093450987
352 Dithers Roanoke 879-09-9845 2529 12th Ave Lake LA 87678 3189760987
351 Ali Mohammed 345-54-8530 88 4th Street Cairo IL 42967 6187894567

tblPatient
tblPtInsurancePgm
PatientId BirthDate Sex ECGClass DiagCode EntryDate
PatientId InsurerId
342 25/04/58 M 3 1 16/12/95
342 678
345 20/07/50 F 4 2 17/12/95 345 678
346 30/11/68 M 1 1 17/12/95 345 45790
350 10/10/35 F 5 13 20/12/95 346 13909
351 08/12/54 M 1 4 01/03/00 350 13909
352 06/01/42 F 2 4 04/01/96 350 45790

Figure 3 —A snapshot of the database tables for the medical research institute

Figure 4 — Relationships diagram for the above database

Marking Schema for Database Design & Implementation


COMP1302
Page 6 of 9
APPROVED

(a) A set of applications has been planned against the database. You have been
asked to express the following requests in SQL (Structured Query Language).
Referential integrity (cascade, delete & update) is maintained automatically by
the system. [5 marks each]

(i) The DiagCode of PatientId 351 was wrongly entered as 4 whereas it


should be 5. Modify the record to store the correct information.

(ii) List the full details of those patients who have no confidential
information.

(iii) List the name of all insurance companies and the number of patients
who are insured by them.

(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 Distinct P.PatientId


FROM tblPatient AS P WHERE P.PatientId not in
(SELECT DISTINCT PI.PatientId from tblPtInsurancePgm PI);

(ii) SELECT P.PatientID, count (PI.PatientId) AS InsuredBy


FROM tblPatient AS P, tblPtInsurancePgm AS PI
WHERE P.PatientID=PI.PatientID GROUP BY P.PatientID
HAVING count (PI.PatientId) > 1;

(iii) SELECT PC.State, Count(P.PatientId) AS NoOfPatients


FROM tblPtConfidential AS PC, tblPatient AS P
WHERE PC.PatientId = P.PatientId GROUP BY PC.State;

(iv) SELECT Count(P.PatientId) AS NoOfPatients


FROM tblPatient AS P, tblPtConfidential AS PC
WHERE PC.PatientId = P.PatientId and
P.Sex='F' and PC.state='LA';

(v) SELECT PC1.FirstName+" "+ PC1.LastName as FullName


FROM tblPtConfidential AS PC1, tblPtConfidential AS PC2
Where PC1.PatientId <> PC2.PatientId and
PC1.State =PC2.State and PC1.City = PC2.City;

Marking Schema for Database Design & Implementation


COMP1302
Page 7 of 9
APPROVED

3. (a) Data Warehousing emerged as a result of advances in the field of information


systems over several decades. Most of these information systems are
distributed over a number of sites, with each site possibly storing data
differently, but organisation management still require a consolidated view of
data for decision support purposes. Today, two major factors drive the need for
data warehousing in most organisations. The first is the need for an integrated,
company-wide view of quality information and the second is the need to
separate operational systems from information systems.
In trying to meet the need for businesses to have an integrated, company-wide
view of quality information, data warehouse designers have to resolve at least
two aspects of data integration. Name the two aspects of integration and use an
appropriate example to describe each of these two aspects of integration.
[15 marks]

(b) You have been approached by an agent of Open Telecoms to discuss their
proposal for adopting and building a Data Warehouse. After discussions with
the agents of Open Telecoms, it occurs to you that Open Telecoms is facing a
problem of customer retention. Customers are free to move between
telecommunications providers and many regularly change suppliers. Such
customers are known as churn in the telecommunications industry. Open
Telecoms has a high churn rate with 20% of their customers changing suppliers
per annum. Therefore, the management of Open Telecoms has placed a high
emphasis on trying to find new ways of reducing this by trying to find answers
to the following questions:
• What is it that makes a customer churn?
• Are some customers more likely to churn than others?
• How can we identify these customers before they churn?
The agent further reveals to you that the directors of Open Telecoms think that
the information that would help them is locked away in their operational
database. Part of the Relational Schema of the Open Telecoms database is
given below:

Customer (Acc_Number, Name, Category, Address, PostCode)


ConnectionPoint (NodeNumber, ClassOfswitch)
TelephoneNumber (TelNumber, TypeOfLine)
Rate (RateCode, RateperSecond)
Call (TelNumber, StartDate, StartTime, NumberCalled, CallDuration,
ChargeFactor)
LineRental (RentalClass, BillFrequency, RentalAmount)
Chargeband (BandCode, BandDescription, StartTime, StopTime,
ChargeFactor)
Invoice (TelNumber, Date, InvoiceAmount, VAT)

After analysing the above relational schema, you suggest to the directors that it
might help if the Open Telecoms could trace the customers’ usage of the
network. The directors are in agreement with your suggestion and have
mandated you to proceed with the design of a data warehouse which should
help the company answer the three questions about churn. You are therefore

Marking Schema for Database Design & Implementation


COMP1302
Page 8 of 9
APPROVED

required to answer the following questions in your design of the data


warehouse.

(i) Identify a suitable subject area for Open Telecoms’s data warehouse.
[3 marks]

(ii) Describe the facts you would record about the subject you have identified
in (i). [6 marks]

(iii) State the dimensions you would consider for the analysis. [6 marks]

4. Keeping and maintaining data electronically becomes an essential factor to the


success for even small business ventures. However, small business often faces the
dilemma of either:

(i) building a simple file system using a spreadsheet tool such as


Microsoft Excel

or

(ii) building a database using affordable and relatively easy to use DBMS
such as Microsoft Access.

Write a report comparing and contrasting the above two options. Your discussion
should give a high-level overview of how various factors influence your choice
between using the different tools. In your answer, give relevant examples using
suitable applications to support your argument for each the above options.
[30 marks]

Marking Schema for Database Design & Implementation


COMP1302
Page 9 of 9

You might also like