0% found this document useful (0 votes)
143 views

Assignment 2

This document provides the details of Assignment 2 for the course COMPUTER SCIENCE 378: INTRODUCTION TO DATABASE MANAGEMENT. The assignment consists of 5 questions worth a total of 100 marks and is due after completing Unit 6. Question 1 involves drawing a composite usage map for an EER diagram of a hospital database. Question 2 involves answering multiple choice questions about data integrity, normalization, and file partitioning. Question 3 involves file organization factors, data clustering, and indexed vs hashed files. Question 4 involves writing an SQL query and defining indexes. Question 5 involves writing several SQL queries about travel agents, customers, and transactions.

Uploaded by

Konrad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views

Assignment 2

This document provides the details of Assignment 2 for the course COMPUTER SCIENCE 378: INTRODUCTION TO DATABASE MANAGEMENT. The assignment consists of 5 questions worth a total of 100 marks and is due after completing Unit 6. Question 1 involves drawing a composite usage map for an EER diagram of a hospital database. Question 2 involves answering multiple choice questions about data integrity, normalization, and file partitioning. Question 3 involves file organization factors, data clustering, and indexed vs hashed files. Question 4 involves writing an SQL query and defining indexes. Question 5 involves writing several SQL queries about travel agents, customers, and transactions.

Uploaded by

Konrad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

COMPUTER SCIENCE 378: INTRODUCTION TO DATABASE MANAGEMENT

Assignment 2

Total: 100 marks

Weight: 15% of your final grade

Due: After you have completed Unit 6.

Answer all of the following questions, and upload your completed work here.

Question 1 (12 marks)


Consider the following EER diagram for the Royal Victoria Hospital (RVH) database.

Data volume and access for this diagram are as follows:

• There are 1 000 patients and 500 items yielding a total of 10 000 usage records in the database.
• There are 50 physicians and a total of 4 000 prescriptions in the database.
• There are 200 treatments in the database.
• There are 50 accesses per day for patient records; of these, 30 request access to both prescription and
usage records.
• There are 20 accesses per day for physician records; of these, 20 request access to prescriptions.

Introduction to Database Management 1


• There are 50 accesses per day to item records; of these, 10 request access to usage records.
• There are 5 direct accesses per day for treatment records.
• Of the total accesses to prescription records, 20 request access to patients, 30 request access to
physicians, and 35 request access to treatment.
• Of the total accesses to usage records, 10 request access to patients and 30 request access to items.

Draw a composite usage map for the RVH database.

Question 2 (12 marks)


Answer the following questions (250 words max/question).

a. What are the typical integrity controls performed in both data integrity and referential integrity?
b. Using an example for each situation, illustrate the three common situations that suggest relations should be
denormalized.
c. What are the advantages and disadvantages of horizontal and vertical partitioning?

Question 3 (12 marks)


Answer the following questions (250 words max/question).

a. What factors should be considered when choosing a file organization?


b. What is the purpose of clustering data in a file?
c. Compare hashed file organization versus indexed file organization. List two advantages of indexed over
hashed, and two advantages of hashed over indexed.

Question 4 (18 marks)


Consider the following database:

Employee(emp-no, name, department, salary), ProjAssigned(emp-no, proj-no, worked-hours)

a. Write one SELECT SQL query to list the numbers and names of all employees with a salary greater than 66
000 who are assigned to projects, the projects they are assigned to, and the corresponding hours worked.
Your list should be sorted by employee name.
b. Define indexes on selected attributes to speed up your query, and justify your selections.
c. Write SQL queries to create the indexes you defined above.

Question 5 (40 marks)


Consider the following three relations:

TRAVEL_AGENT (name, age, salary)

CUSTOMER (name, departure_city, destination, journey_class)

TRANSACTION (number, cust_name, travel_agent_name, amount_paid)

Write SQL statements to answer the following questions.

2 Computer Science 378


a. Compute the number of different customers who have a transaction.
b. Display the name of the oldest travel agent.
c. List the total number of transactions for each travel agent. Consider only those transactions where the
amount paid exceeds 1 000.
d. Display the names and ages of the travel agents who have arranged journeys for customer “John Smith”, in
descending order of age (use a subquery).
e. Display the names and ages of travel agents who have arranged journeys for customer “John Smith”, in
descending order of age (do not use a subquery).
f. Display the age of travel agents who have arranged journeys for customer “John Smith” to “Ottawa” (use a
subquery).
g. Display the age of travel agents who have arranged journeys for customer “John Smith” to “Ottawa” (do
not use a subquery).
h. Display the names and salaries of all travel agents who did not arrange journeys for customer “John Smith”,
in ascending order of salary.
i. Display the names of travel agents who have five or more transactions.
j. Display the names of all travel agents who have arranged at least ten journeys to “Ottawa”.

Introduction to Database Management 3

You might also like