[prev] 67 [next]

Exercise 10: SQL → RelAlg

Convert the following queries into (efficient?) RA expressions

select * from R where a > 5;

select * from R where id = 1234 and a > 5;

select R.a from R, S where R.i = S.j;

select R.a from R join S on R.i = S.j;

select * from R, S where R.i = S.j and R.a = 6

select R.a from R, S, T where R.i = S.j and S.k = T.y;

Assume R.id is a primary key and R is hashed on id

Assume that there is a B-tree index on R.b