Sei sulla pagina 1di 9

DATABASE MANAGEMENT WORKSHEETS

Theory Questions

The Motor Vehicle Department of a company maintains a database with two tables
shown below to store information on vehicles and their owners.

1 | Page
DATABASE MANAGEMENT WORKSHEETS
Question#2

2 | Page
DATABASE MANAGEMENT WORKSHEETS

Question# 3

3 | Page
DATABASE MANAGEMENT WORKSHEETS
A database contains data on motor vehicle accidents involving the driver,
passenger, pedestrian, cyclist or other factors in recent years. He wants to extract
some information based on the following tables:

Table: CATEGORY

Type Name
DR Driver
PA Passenger
PE Pedestrian
CY Cyclist
OT Other

Table: ACCIDENTS

ACCNO CNAME Type Hospitalized INSURANCE


101 Jones, A. DR Y BIC
121 James, P. DR Y MITUAL
124 Hunte, E. DR N SEGIDOR
127 Gill, A. PA Y MITUAL
131 Maughan, F. DR N SEGIDOR
135 Jack, R. PE N BIC
139 Smith, A. CY N BIC
143 Brooks, K. CY Y SEGIDOR
152 Lashley, M. DR N MITUAL
157 Dash, G. PA Y MITUAL
(a) State the most appropriate data type for the Hospitalized field (1 mark)

(b) State the name of a primary key in the ACCIDENTS (1 mark)

(c) State the fields in EACH Table that would be used to link the two tables
(2 marks)

(c) Write queries to produce:


(i) all drivers who were hospitalized (2 marks)

(ii) all cyclists who were not insured with BIC (2 marks)

4 | Page
DATABASE MANAGEMENT WORKSHEETS
Question# 4

5 | Page
DATABASE MANAGEMENT WORKSHEETS

6 | Page
DATABASE MANAGEMENT WORKSHEETS
Question# 5

Consider the following database which contains TWO tables that store data on
examinations held at a school.

TABLE 1: SUBJECT

Subject SubjectNa Cost


ID me
25 Biology $45.
00
45 English A $40.
00
86 Mathemati $40.
cs 00
91 IT $55.
00

TABLE 2: SCHEDULE

Subject Pap Time Locati Time


ID er on in(hours)
25 1 Morning Hall 1
25 2 Afterno Lab 2
on
91 1 Afterno Room 1
on 1
91 2 Morning Librar 2
y
86 1 Morning Hall 1

2(a) State the number of records in the SUBJECT table above.

(b) Identify the primary key in the SCHEDULE table.

(c) State the data type of EACH field in the SUBJECT table.

(d) Write a query to list all the papers that occur in the Morning and were held in
the Hall.

(e) How many fields are in the SCHEDULE table and name them?

(f) List two properties of a field.

Question # 6
A beverage manufacturer uses a database that contains two tables to store
information on customers.

7 | Page
DATABASE MANAGEMENT WORKSHEETS
TABLE 1: CATEGORY
Type Name
D Distributor
W Wholesaler
R Retailer

TABLE 2: CUSTOMER
CNO CNAME TYPE OUTLETS YTD SALES
D100 Bish and Sons D 5 300,000.00
R100 Saywack R 1 25,000.00
W100 Corbin W 2 75,000.00
D200 Hamilton D 3 100,000.00
W200 Singh W 3 65,000.00
R200 Mohan R 2 50,000.00
W300 Peter W 2 30,000.00

(a) List TWO properties of a field.


(b) Explain how you would delete a field from a table.
(c) Give the name of the primary key in the CUSTOMER table.
(d) Write a query to find ALL distributors with YTD SALES greater than 50,000.00.

Question# 7

The Traffic Department is concerned about reckless driving by drivers of public


transportation vehicles using a particular route. On a daily basis, the traffic
development would like to store information on the Registration Number of the
Vehicle, the type of Vehicle (Bus, Mini-Bus, and Hired Car), the driver of the
vehicle and the number of tickets issued to the driver. You have been asked to
create a database table named TICKET to store.
(a) Create the structure of the table TICKET. Your structure should indicate the
name, data type and size for EACH field in your table.
(b) State ONE reason for using a form to input data into your table.
(c) Give ONE example of a record in the TICKET table.
(d) Suppose you now need to store the sex of the driver, what would you do to
accomplish this task, assuming that your table has records already
(e) Write a query to show ALL female drivers of Hired Cars.
(f) How would you print the data in table for the date, 24/12/06?

Question#8

The Office of Investment uses a database named FOREIGN with two tables
shown below to store data on foreign companies operating in the company:

8 | Page
DATABASE MANAGEMENT WORKSHEETS
Table 1: COMPANY

CID NAME SECTOR Ccode EMPLOYEES


A200 BJ Petroleum CA 75
M200 CMX Mining RU 120
M100 FEDCO Electricity US 190
A100 TPL Agriculture TT 230
T100 ATM Telecommunicati US 550
ons

Table 2: COUNTRY

Ccode Cname
US United State of America
CA Canada
TT Trinidad and Tobago
RU Russia

(a) State the data type of the Sector and Employees fields of the COMPANY table.
(b) Identify a primary key for the COMPANY table.
(c) The records in the COMPANY table are sorted. Indicate the field name and the
order of the sort.
(d) State the name of the field that would be used to join the two tables.
(e) Write a query to find ALL companies with over 200 employees in the
Telecommunications sector.

9 | Page

Potrebbero piacerti anche