Here (at slide #46) says: Show that the intersection R ∩ S
can be expressed using a
combination of projection and an equijoin.
How is it possible? For what I know, R ∩ S = R - (R - S)
, so for the intersection the two relations must have the same attributes. Having them the same attributes, why should we need projection?
In slide 27 of the file that you have linked, it is said that the relations argument of the union and difference must only have the same arity, not necessarily the same attributes, and this is true also for the intersection.
So they can have different names, and in this case if you do an equijoin on R and S over the attributes in the same position the result is equivalent to the intersection but with more attributes that those necessary, so the projection is required to get a relation with the right number of attributes.
For instance, suppose you have:
R(A, B, C) ∩ S(D, E, F) = The set of tuples appearing both in R and S
This is equivalent to:
π(A,B,C) (R(A, B, C) ⋈(A=D ∧ B=E ∧ C=F) S(D, E, F))
Note that the projection could be done by chosing any of the two attributes for each couple (A, D), (B, E) and (C, F).
Finally note that other definitions of the set operators on relational algebra require that operands have attributes with the same name and type.