In: Advanced Math
Given the below relational algebra expressions, use domain and tuple relational calculus to specify them:
a. σx=z ( R(a,b,c) )
b. πx,y ( R(x,y,z) )
c. R(x, y) / S(x)
d. R(a,b,c) ∪ S(a,b,c)
e. R(a,b,c) – S(a,b,c)
f. R(d,e,f) ∩ S(d,e,f)
g. R(x,y,z) × S(f,g,t)
In Data Base Management System:
(a) σx=z ( R(a,b,c) ):
is the select operator, where:
Therefore, σx=z ( R(a,b,c) ) implies:
Select the tuple R(a,b,c) where x=z
(b) πx,y ( R(x,y,z) ):
is the project operator, where:
Therefore πx,y ( R(x,y,z) ) implies:
From a database take the columns x and y
(c) R(x, y) / S(x):
The division operator works as follows:
R(Z) / S(X), where
. Let Y = Z - X (and hence Z
= X
Y); that is, let Y be the set of attributes of R that are
not attributes of S.
Therefore R(x,y)/S(x) implies:
Where, T<-R(A,B)/S(A)
(d)R(a,b,c) ∪ S(a,b,c):
The result of , is a relation that includes all tuples that are either in R or in S or in both R and S
Duplicate tuples are eliminated
(e)R(a,b,c) - S(a,b,c):
The result of , is a relation that includes all tuples that are in R but not in S.
The attribute names in the result will be the same as the attribute names in R.
(f) R(d,e,f) ∩ S(d,e,f):
The result of the operation , is a relation that includes all tuples that are in both R and S
The attribute names in the result will be the same as the attribute names in R
(g) R(x,y,z) × S(f,g,t):
This operation is used to combine tuples from two relations in a combinatorial fashion.
Denoted by R(A1, A2, . . ., An) x S(B1, B2, . . ., Bm), The result is a relation Q with degree n + m attributes: Q(A1, A2, . . ., An, B1, B2, . . ., Bm), in that order.
Hence, if R has tuples (denoted as |R| = ), and S has tuples, then R x S will have tuples.