IS222 2010 Sol
IS222 2010 Sol
Serving the Cook Islands, Fiji, Kiribati, Marshall Islands, Nauru, Niue, Samoa, Solomon Islands, Tokelau, Tonga, Tuvalu, and Vanuatu.
Page 1 of 12
Section A – Multiple Choice Questions (Each question has only one answer and is worth 2 marks)
2. A CUSTOMER table’s primary key is CUS_CODE. The CUSTOMER primary key column
has no null entries, and all entries are unique. This is an example of ____ integrity.
a. entity
b. referential
c. complete
d. null
3. A ____ entity is composed of the primary keys of each of the entities to be connected.
a. bridge
b. composite
c. unary
d. binary
6. A(n) ____ is an alternate name given to a column or table in any SQL statement.
a. alias
b. data type
c. stored function
d. trigger
7. The ____ special operator is used to check whether an attribute value is null.
a. BETWEEN
b. IS NULL
c. LIKE
d. IN
Page 2 of 12
8. All transactions must display ____.
a. atomicity, serializability, and durability
b. durability and isolation
c. serializability, durability, and isolation
d. atomicity, durability, serializability, and isolation
9. As long as two transactions, T1 and T2, access ____ data, there is no conflict, and the order
of execution is irrelevant to the final outcome.
a. shared
b. common
c. unrelated
d. locked
10. ____ are rules that applies to the two-phase locking protocol.
a. Two transactions cannot have conflicting locks.
b. No unlock operation can precede a lock operation in a different transaction.
c. No data is affected until all locks are released.
d. No data is affected until the transaction is in its locked position.
Page 3 of 12
Section B – Short Answer and Case Study Questions
Use the following description to answer parts (A) to (C) of this question
AcuteRentals store data about the customers who rent out the cars. The details about the
customer that is kept by the company include the Customer Number (unique for each
customer), the customer’s name, residential and postal addresses, and home and work
phone numbers.
A customer can take any number of cars over a period of time but is limited to taking out
one car at a time. At any given point in time, a customer can rent only one car. When
renting out a car to a customer, AcuteRentals records the rent number (unique for each
rent record) customer number, date, car registration, pick up date, return date, and the
total charge.
For each car the company records car registration (unique), description, and mileage.
(B) Identify all possible business rules for the above case study. (6 marks)
1. A customer can rent one or many cars and each car can be rented by no or many
customers
2. A car can have one or many inspection, but during a particular inspection only
one car is checked.
3. A can be inspected by one or many inspectors and each inspector can inspect no
or many cars.
(C) Create an ERD showing a possible database design. Show the entities, relationship
between the entities (show the connectivity, cardinality, and strength of relationship),
primary and foreign keys, and other attributes. (16 marks)
Page 5 of 12
Question 12 – Normalization (18 marks)
A small medical clinic stores data about the medicine/drug that is given out to patients by
the doctors using the following table. The patients receive the drug when they come to
see a doctor.
Study the following table and use it to answer parts (A) to (C) of this question.
(A) Identify the repeating group in the table given above. (2 marks)
Page 6 of 12
(B) Draw a dependency diagram showing all dependencies. (8 marks)
doc_id
doc_lname
doc_fname
pat_num
pat_lname
pat_fname
pat_dob
visit_num
drug_code
drug_name
drug_price
visit_date
Page 7 of 12
(C) Convert your table structure shown in part (B) to 3NF and draw the new dependency
diagrams. (8 marks)
Page 8 of 12
Question 13 – Structured Query Language (39 marks)
Use the following description and the database schema given below to answer the parts
(A) and (H) of this section. Write SQL statements to answer each part.
Assume the following database is used to store the sales data for a company.
Note: This is the same database you have used to do your labs.
(A) List the customer code, customer name (first name + initial + last name), cus_balance
sorted by customer last name in ascending order. (4 marks)
select cus_code, cus_fname & " " & cus_initial & " " &
cus_lname As [Name], cus_balance
from customer
order by cus_lname;
Page 9 of 12
(B) List the product code and description of all products that are below the minimum
required quantity. (4 marks)
(C) List the vendor code, name, and the number of products that is supplied by the
vendor. Include those vendors that do not supply any products. (4 marks)
OR
(D) List the product code and description of the products with minimum and maximum
prices. (4 marks)
UNION
Page 10 of 12
(E) List the invoice number, invoice date, total number of lines in that invoice and the
total sales amount for that invoice. Sort the list by the total invoice amount in
decreasing order and list only those invoices where the total invoice amount is greater
than 100. (6 marks)
(F) List the vendor code, vendor name, and vendor phone of all vendors sorted by the
name of the vendor in ascending order. (4 marks)
(G) Given below is the data dictionary for the Enroll entity. Use it to write the SQL
statement that will create the Enroll table. (5 marks)
MS Access
CREATE TABLE enroll (
offeringid CHAR(5) NOT NULL,
studentid CHAR(9) NOT NULL,
enrollgrade VARCHAR(2),
CONSTRAINT enroll2_pk PRIMARY KEY(offeringid,studentid),
CONSTRAINT enroll_fk1 FOREIGN KEY (offeringid) REFERENCES
offering);
MySQL
CREATE TABLE enroll2(
offeringid CHAR(5) NOT NULL,
studentid CHAR(9) NOT NULL,
enrollgrade VARCHAR(2),
CONSTRAINT enroll2_pk PRIMARY KEY(offeringid,studentid),
CONSTRAINT enroll_fk1 FOREIGN KEY (offeringid) REFERENCES
offering(offeringid));
Page 11 of 12
(H) Change the enroll table by adding a new column named enrollmark which is of
Double datatype. It is an optional field. (4 marks)
(I) List the invoice number, invoice date, product code and description, line units and the
line price details for invoice number 1006. (4 marks)
Page 12 of 12