COMP3311 Final Exam 20T3 |
The University of New South Wales COMP3311 Database Systems Final Exam 20T3 |
Database Systems |
Assume that we have a collection of relations as follows:
R(a,b,c) S(d,e) T(a,d,f)
Write relational algebra equivalents of the following SQL statements. You may write multiple steps, with one RA operation in each step. Use the notation which has implicit projections and renaming by writing attribute names on the left-hand side of the "assignment", e.g.
Tmp1(a,b) = Sel[c=5]R
rather than
Tmp = Rename[R→Tmp](Proj[a,b](Sel[c=5]R))
The final step should produce a relation called Res.
Exercises:
select * from R;
select a,b from R where c < 0;
select a,d from R join S on (b = e) where c < 0;
select b,c,e,f from R natural join T natural join S;
Instructions: