391 views
0 votes
0 votes

Please clear my doubt by solving this !!

2 Answers

1 votes
1 votes

if there is no common attributes in both relations, natural join simply returns cross product of those relations ( i don't know the reason why this is defined like this)

therefore o/p case 3 is simply cross-product of R and S

 

coming to Case 1 and Case 2:-

R and S have common attribute, which is C 

therefore it is equvivalent to

select *

from R,S

where R.C = S.C

case 1 o/p is :- (A B C D) = (1 2 3 4), (7,8,9,10) ------------ only two rows

case 2 o/p is :- (A B C D) = NULL ------------ no row is matched due to R.C=S.C doesn't satisfied by atleast one row

edited by
1 votes
1 votes
In Natural Join first we do the cross product then we do the selection and the selection is done in between the common attribute of the relation and when we don't have the common attribute then we simply do the cross product.

Case 1: In this, we have C as the common attribute so first we do the cross product and check where (R.C=S.C) then we select those tuples. so, in the result, we get (1,2,3,4)and(7,8,9,10) as 3 and 9 are common in C.

Case 2: In this, we have C as the common attribute we do the same procedure as above but here we don't have any common values in C. so in the result we will get the Empty relation as no tuple will be selected.

Case 3: In this we don't have any common attribute so we do the cross product only.

Related questions

0 votes
0 votes
1 answer
2
Shukrayani asked Oct 30, 2018
343 views
A system where commutativity is considered different, in how many ways the join of n relations r1,r2, . . . ,rn canbe taken?
0 votes
0 votes
1 answer
3
Balaji Jegan asked Oct 23, 2018
178 views
3 votes
3 votes
1 answer
4
Rahul_Rathod_ asked Jan 30, 2018
578 views
what is different types of joins and what is difference between them ?please explain with example.