Sie sind auf Seite 1von 2

Database Systems

Sheet 3
1. Consider a relation R(A,B,C,D) with multivalued dependency AC->->D and functional
dependency B->A.
(a)
Find all !F violations. For any that you find, e"plain why each is a violation, or e"plain
why none are violations.
(#)
Decompose the relations into a collection of relation schemas in !F.
(c)
Consider the ori$inal relation R(A,B,C,D) with multivalued dependency AC ->->D and
functional dependency B->A. %hich of the followin$ hold& For each, $ive reasons why it
holds or at least one countere"ample
i.
B ->-> CD
ii.
A ->-> D
iii.
AC -> D
'. (his pro#lem is #ased on the relations)
3. Customers(custID, name, email, shipAddr)
4. Orders(orderID, custID, itemID, date, status)
5. Items(itemID, description)
%rite in relational al$e#ra the followin$ *ueries. +ou may write a se*uence of steps with
named temporary relations if you li,e.
(a)
Find the email of the customer(s) with name -.aura .ee.-
(#)
Find the names of the customers whose orders were placed on /an. 1, '000, and whose
order status is -lost.-
(c)
Find the descriptions of the items ordered #y -.aura .ee.-
(d)
Find the names of the customers who have two or more orders with status -pendin$.-
1. Consider the followin$ relational data#ase schema)
. !tudent(ID, name, dept, status) "" status # $%rad$ or $under%rad$
&. "" ID is a 'e(
). *A(ID, ad+isor, dept) "" (ID,ad+isor) to%ether are a 'e(
,-. .A(ID, course, dept) "" (ID,course) to%ether are a 'e(
%rite the followin$ in relational al$e#ra)
a)
Find the names of all $raduate students who are neither an RA nor a (A.
#)
Find the names of all $raduate students who are an RA or a (A in a department other
than their own.
11. +ou will #e wor,in$ with the followin$ schema)
,/. 0mplo(ee(!!1, name, salar(, D1o)
,3. Department(D1o, Dept1ame, 2%r!!1)
,4. 3ro4ect(31o, location, 3ro41ame)
,5. 5our6o%(!!1, 31o, hours)
(he 2mployee relation provides a list of employees with their 33!, name, salary, and
department num#er (D!o). (he 33! is uni*ue for each employee. 2ach employee
#elon$s to only one department. (he Department relation contains a list of the
departments for the company. 4ts schema includes a uni*ue department num#er called
D!o. 4t also includes the name of the department (Dept!ame) and the social security
num#er of the department5s mana$er (6$r33!). 2ach department has a only one
mana$er. (he 7ro8ect relation includes a uni*ue pro8ect num#er (7!o), location and the
pro8ect name (7ro8!ame). An employee can #e assi$ned to any num#er (includin$ 9ero)
pro8ects. 2ach pro8ect has at least one person assi$ned to it. Finally, the :our.o$ relation
lists for each pro8ect the num#er of hours of wor, for each employee who is assi$ned to
that pro8ect. (he ,ey of this relation is 33! and 7!o. %rite the followin$ *ueries in
Relational Al$e#ra. +ou may use assi$nment of intermediate results for lon$ *ueries.
a)
Find the name and the 33! of everyone who wor,s more than 100 hours on one
particular pro8ect.
#)
Find the name and 33! of everyone who wor,s for department num#er 1 and also wor,
on pro8ect num#er '.
c)
Find the name and the 33! of everyone who wor,s on at least two pro8ects.
d)
Find the 33! of everyone who is not wor,in$ on any pro8ect.
e)
(Extra Credit) Find the name and the 33! of everyone who wor,s on every pro8ect.
f)
(Extra Credit) Find employees and their mana$ers who wor, the fewest hours for each
pro8ect. A tuple of (2mployee33!, 2mployee!ame, 6ana$er!ame, 7!o) should #e
listed for every pro8ect.

Das könnte Ihnen auch gefallen