Given R with n tuples S with m tuples n<m then How many minimum and maximum tuples in follwing relations . Please Justify with Reason / Examples
R NATURAL JOIN
CONSIDER ANOTHER RELATION
R NATURAL JOIN S
@santhoshdevulapally . Nope that is wrong !
If there are no attributes in common between two relations and you perform a natural join, it will return the cartesian product of the two relations
@pc,see this one.
Natural join does not use any comparison operator. It does not concatenate the way a Cartesian product does. We can perform a Natural Join only if there is at least one common attribute that exists between two relations. In addition, the attributes must have the same name and domain.
Natural join acts on those matching attributes where the values of attributes in both the relations are same.
[Someone should verify . This is what I think]
1. R UNION S
R UNION S
max : n+m
Reason : union we add all the tuples from both relations. ie When R and S have no common tuple.
Reason : The minimum is n (the greatest of the two sizes, m and n). When all the tuples of R also exist in S.
2. R INTERSECTION S
R INTERSECTION S
max : m ( m<n )
Reason : both relation contains same tuples then we may get maximum m keys
Reason : taking m=n=null if no common tuples in both relations
3. R - S
R - S
max : m
Reason : if they are disjoint then in R-S we will get all tuples of R
Reason : if all tuples in R is also present in S
4. S - R
S - R
max : n
Reason : as explained above
Reason : m<n there will be some tuples in S after deleting the common tuples
5. R natural join S
R natural join S
max : n*m
Reason : if no matching key constraints natural join will produce Cartesian product )
Reason : Identical with case 2 (INTERSECTION).
6. R LEFT OUTER JOIN S
R LEFT OUTER JOIN S
max : m*n
Reason : if all rows in left tables matches with all rows in right table
min: m (could be 0 when m= 0)
Reason : The minimum is 1 when m=1 , minimum is 2 when m=2, minimum is 0 when m=0
7. R / S
R / S
max : m
Reason : when n=0
Reason : Consider that relational division is similar to integer division. 3 / 7 gives 0 in integer division for example. Try to convert this into relational division
3 / 7
For natural join
mn is max.
Case 1: if there is a common attribute between and , and every row of R matches with the each row of S - i.e., the join attribute has the same value in all the rows of both and ,
Case 2: If there is no common attribute between R and S .
Min is 0.
If There is a common attribute between R and S and nothing matches.