edited by
525 views
1 votes
1 votes

Let r and s be two relations over the relational schemas R and S respectively, and let A be an attribute in R. Then the relation algebra expression σ(A=a) (r⋈s) is always equal to( Marks: -0.33 )

  1.    σ(A=a) (r)⋈s
  2.  r
  3.  None of the above
  4.  σ(A=a) (r)
edited by

2 Answers

0 votes
0 votes

Let r

p a b
1 1 2
2 4 3
3 4 4

 s

b c
3 12
5 13
2 15

 (r⋈s)

p a b c
1 1 2 15
2 4 3 12

1. σ(a=4) (r⋈s) =

2 4 3 12

2.let p= σ(a=4)(r) =

2 4 3
3 4 4

p⋈s=

2 4 3 12

Note:- same scenario in the case of cross product... 

when attribute is not common:-

r

1 1 2
2 4 3

3 12
5 13

 σ(a=4) (r⋈s)=2 touple

σ(a=4) (r)⋈s) = 2 touple

edited by
0 votes
0 votes

First thing first, it's a natural join and the answer will be a,

Case I -- let there is a common column

if R and S have common column, then the table will join based on that and then the tuples with A = 'a', will be selected.

Now, if you select tuples with A = 'a', and then do the natural join then also the result will be the same. You just are applying the conditions in opposite order.

let they have test as common attribute, then the above relational algebra can be written as,

σ(A=a) and (r.test = s.test) (rxs), joins are just used to minimize the comparisons, while combining tuples.

Case II -- let there be no common column

Natural join will perform the Cartesian product, in case of no common column and then apply the condition A = 'a', which is equivalent to selecting the tuples with condition A = 'a' and then apply the Cartesian product.

Coz in both cases in the end the tuples gets selected are with condition A = 'a'.

Related questions

0 votes
0 votes
0 answers
1
2 votes
2 votes
2 answers
3
admin asked Mar 30, 2020
909 views
If $R$ is a relation in Relational Data Model and $A_1,A_2,\dots A_n$ are the attributes of relation $R$, what is the cardinality of $R$ expressed in terms of domain of a...