You are on page 1of 3

Computer Science 378: Introduction to Database Management

Sample Examination

You will have 2 hours to complete a similar closed-book examination.

Question 1
A real estate company uses a database to store information about customers, property, and contracts.
The following relations are used in the database:

Customer: Customer number (unique), name, mailing address, Balance, lawyer name, Discount.
Contract: Customer number (unique), Agent number (unique), Property_ID (one per contract), Date of
contract, Property addresses, Property value, Type, Number of rooms, Land size, Built size, Tax value)

The following functional dependencies apply.


customer_no  name
customer_no  mail_address
customer_no  balance
customer_no  lawyer_name
customer_no  discount
{customer_no, Agent_no}  property_id
{customer_no, Agent_no}  date_contract
property_id  property_address
property_id  value
property_id  type
property_id  number_rooms
property_id  land_size
property_id  built_size
property_id  tax_value

Transform these relations into 3NF (please use only the attributes described above, and do not add any
new attributes).

Question 2
Draw a class diagram for the following situation.

An airline company has a number of planes. The attributes of a plane include plane_id (unique), name,
and vendor. The airline company serves many destinations. The attributes of a destination include
destination_id (unique), name, and flight_date. Each plane flies to one or more destinations; or it may
be used as back-up; or it may be under maintenance, and therefore will not fly to any destination. For
each plane undergoing maintenance, the company records the name of the technician and the type of
maintenance performed. A destination may be served by one or more planes. Each plane’s service

Introduction to Database Management 1


charges vary by the number of destinations the plane serves. The airline company maintains records of
the service charges for each plane when it flies to a certain destination. At the end of each year, the
airline company applies a depreciation percentage to each plane. The airline company calculates each
plane’s percent depreciation based on the amount of service charges and the total hours of flying for
that plane.

Question 3
Consider the following three relations:

Manager(name, address, specialization, salary)


Employee(name, address, rank, salary)
Project (proj_num, emp_name, manager_name, duration)

Write the SQL queries corresponding to the following questions.


a. Find the number of different employees who are assigned to projects.
b. Find the managers’ average salary.
c. List the name and number of projects supervised by each manager.
d. Show the names and salaries of managers who supervise employees of rank “beginner" in ascending
order of salary (use a subquery).
e. Show the names and salaries of managers who supervise employees of rank “beginner" in
descending order of salary (do not use a subquery).
f. Show the names and salaries of supervisors who supervise more than 20 employees.

Question 4
Consider the following database.

TRAVEL-AGENT (name, age, salary)


CUSTOMER (name, departure_city, destination, journey_class)
TRANSACTION (number, cust_name, travel_agent_name, amount_paid)

a. Write an SQL query to display the names of all travel agents who arranged trips for customer “John
Smith”.
b. Define indexes on selected attributes to speed up your query. Justify your selections.

Question 5
Suggest an appropriate recovery technique for each of the following situations.
a. You were working from home and updating a database at work when the transaction was aborted.
b. A customer service representative entered an incorrect data price for a customer transaction.
Several weeks after the accounting department has processed the transaction, the customer
returned and discovered the mistake.

2 Computer Science 378


Question 6
Contrast two-tier architecture with three-tier architecture.

Question 7
a. Briefly contrast transient data with periodic data in data warehousing.
b. Briefly discuss the characteristics of a surrogate key, as used in a data warehouse or data mart.

Introduction to Database Management 3

You might also like