2015JUNEMIS504
2015JUNEMIS504
FACULTY OF COMMERCE
EXAMINATION
_____________________________________________________________________________________
DATABASES MIS504
DURATION 3 HOURS
INSTRUCTIONS TO CANDIDATES
Page 1of 5
QUESTION ONE
i). What does it mean to say that the two relations R and S are union compatible [2]
ii). Given two relations R and S. For each of the following, stating any assumption,
give the resulting (a) schema ( b) cardinality (c) extension (d) degree
1) = ∪ [4]
2) = × [4]
3) = ⋈ [4]
4) = ( )( ) [4]
iii). How does multiplicity represent both the cardinality and the participation
constraint on a relationship [3]
QUESTION TWO
i). Give an algorithm for determining whether a decomposition of a relation R over a
set of FDs F into a set of relations R1, R2,…,Rn is a lossless [7]
ii). State the first three Armstrong’s Axioms for functional dependencies. Prove that
each of them is SOUND and COMPLETE [12]
iii). Prove that any relation schema with two attributes is in BCNF [6]
iv). Consider the following proposed rule for functional dependencies
{XY→Z, Y→Z} → {XW→Z}. Prove that this rule is not SOUND [6]
Page 2of 5
QUESTION THREE
a) Clearly explain the difference relational algebra and tuple relational
calculus
Consider the following schema
Book(acc-no:integer,yr_pub:integer,title:string)
User(b_name:string,b_address:string,card_no:string)
Borrow(acc_no:integer,card_no:string,DOI:integer)
Supplier(acc_no:integer,s_name:integer,price:integer,DOI:string) [25]
Write the following queries in SQL, Relational Algebra and Tuple Relational
Calculus.
i). Find out all books issued under card number F53
ii). Find all borrowers and their addresses for those who issued a book on
“14/08/95”
iii). Find all borrowers who have issued a book supplied by “KWENDA” or
“CHIKUNI”
iv). Find all the names of all the suppliers who have the same address as
“KWENDA”
v). Find the supplier who has supplied
QUESTION FOUR
“Martial Arts R Us” (MARU) needs a database. MARU is a martial arts school with
hundreds of students. It is necessary to keep track of all the different classes that
are being offered, who is assigned to teach each class, and which students attend
each class. Also, it is important to track the progress of each student as they
advance. Create a complete Crow’s Foot ERD for these requirements: [25]
Students are given a student number when they join the school. This is stored
along with their name, date of birth, and the date they joined the school.
All instructors are also students, but clearly, not all students are instructors. In
addition to the normal student information, for each instructor, the date that they
Page 3of 5
start working as an instructor must be recorded, along with their instructor status
(compensated or volunteer).
An instructor may be assigned to teach any number of classes, but each class
has one and only one assigned instructor. Some instructors, especially volunteer
instructors, may not be assigned to any class. A class is offered for a specific
level at a specific time, day of the week, and location.
Students may attend any class of the appropriate level during each week so
there is no expectation that any particular student will attend any particular class
session. Therefore, the actual attendance of students at each individual class
meeting must be tracked.
A student will attend many different class meetings; and each class meeting is
normally attended by many students. Some class meetings may have no
students show up for that meeting. New students may not have attended any
class meetings yet.
At any given meeting of a class, instructors other than the assigned instructor
may show up to help. Therefore, a given class meeting may have several
instructors (a head instructor and many assistant instructors), but it will always
have at least the one instructor that is assigned to that class. For each class
meeting, the date that the class was taught and the instructors’ roles (head
instructor or assistant instructor) need to be recorded. For example, Mr. Cehnes
is assigned to teach the Monday, 5:00 pm, intermediate class in Room #1.
During one particular meeting of that class, Mr. Cehnes was present as the head
instructor and Ms. Jones came to help as an assistant instructor.
Each student holds a rank in the martial arts. The rank name, belt color, and
rank requirements are stored. Each rank will have numerous rank requirements.
Each requirement is considered a requirement just for the rank at which the
requirement is introduced. Every requirement is associated with a particular
rank. All ranks except white belt have at least one requirement.
A given rank may be held by many students. While it is customary to think of a
student as having a single rank, it is necessary to track each student’s progress
through the ranks. Therefore, every rank that a student attains is kept in the
Page 4of 5
system. New students joining the school are automatically given a white belt
rank. All ranks have at least one student that has achieved that rank at some
time.
QUESTION FIVE
i). Define two principal integrity rules for the relational model. Discuss why it is
desirable to enforce this rules [5]
iii). Consider the relation r(X,Y,Z,W,Q) and the set r={X→Z, Y→Z, Z→W,
WQ→Z,ZQ→X} and the decomposition of r into relations R1(X,W), R2(Y,X),
R3(Y,Q), R4(Z,W,Q) and R5(X,Q). Using the lossless join algorithm determine if
the decomposition is lossless or losyy [10]
END OF EXAM
Page 5of 5