A database contains the tables E (for Employee) and D (for Department):
|A||Computer||17 Some Street|
|B||Security||8 Some Road|
Expressed with the usual notation:
E(Enr, Ename, Tel, Dept)
State the following three queries in
D(Dnr, Dname, Address)
- relational algebra systematically translated from SQL
- efficient relational algebra
Hint 1: The systematic translation of
What is the name of Tom's department?
(With the example data above, the result would be "Security".)
Which people (with number and name) work in Security?
The phone number of everyone called Tom who works in security?
select A, B, C, ...
from T1, T2, T3, ...
PROJECTA, B, C, ...(SELECTCONDITION(T1 x T2 x T3 x ...))
Hint 2: A relational algebra query is usually more efficient if it produces
smaller intermediate results.
11 februari 2007