You are on page 1of 3

Chancellor College

Department of Computer Science


Test Two
COM222 Database Systems
Answer All Questions 2 hours
1. Describe a database management system. (4)

2. Explain how SQL provides physical and logical data independence. (4)

3. Define full functional dependency. (2)

4. Specify relation algebra query to retrieve the names of all employees who work on every
project on the COMPANY relational database schema shown in Figure 1 below. Also show
the result of the query as it would apply to the database state in Figure 1 below. (4)
5. Consider the two tables 𝑇 and 𝑆 shown below.
T S
P Q R A B C
10 a 5 10 b 6
15 b 8 25 c 3
25 a 6 10 b 5

Show the result of the following operation: 𝑇 ⋈ 𝑇.𝑃=𝑆.𝐴 𝒂𝒏𝒅 𝑇.𝑅=𝑆.𝐶 𝑆 (4)
6. Using the Company relational Database Schema in Figure 1 below write an SQL statement to
retrieve:
a. The project number, the project name, and the number of employees who work on that
project. (4)
b. For each department that has more than five employees, the department number and the
number of its employees who are making more than K40,000 (5)

COM222 Database Systems Page 1 of 3


7. A first try to design a database for a bookshop to track details of books sold by the bookshop
produced the schema: BOOKSHOP [Bookshop#, Bookshop_Addr, (BookNo, BookTitle,
BookAuthor, BookPublisher), Copies_Sold]. Assume that Act[a,b,c(FK),(d,e)] represents a
schema “Act” where a,b,..,e are attributes, (d,e) represent a repeating attribute or group of
attributes, c represent primary key and (FK) indicates attribute c is a foreign key.

An instance of this schema is shown below:


Bookshop Bookshop_Addr Book_No BookTitle BookAuthor BookPublisher Copies_Sold
Maneno Box 123, LL 1 MEC TDM Montfort Press 45
Update 9
Maneno Box 123, LL 2 Lauderdale CM Likuni 8
Ward
Claim Box 20, BT 3 Unofficial KGM Dzuka 12
Chanco Box 280, ZA 4 Nsanje ML Montfort Press 7
Central
Montfort P/Bag 3, BLK 1 MEC TDM Montfort Press 3
Update 9

a. Identify all the functional dependencies in the relation schema (3)

b. Normalise the table into 3rd Normal form. Show all the intermediate normal forms and
the functional dependencies defining the forms or otherwise. (7)
8. Consider the following relational algebra expressions:
i. πw((A ⋈x=y B) ⋈z=v C)
ii. πw((πv(C) ⋈v=z πwyz(B)) ⋈y=x A)
a. Translate the relational algebra expressions into their equivalent query trees (4)
b. Assuming that (ii) is transformed from (i), explain why query (ii) can be considered to
be more efficient than query (i) (4)

COM222 Database Systems Page 2 of 3


FIGURE 1 COMPANY RELATIONAL DATABASE SCHEMA

COM222 Database Systems Page 3 of 3

You might also like