I have recompiled the above answer more lucidly and added some more relational algebra operations. Hope, it's useful :)
Consider Relations R and S where R is having m tuples and S is having n tuples. m<=n . What would be the minimum and maximum number of tuples in each of the following cases (Assume that nothing is mentioned about key constraints)
- R union S
- R intersection S
- R-S
- S-R
- R NATURAL JOIN S
- R Left OUTER Join S
- R/S
- R CROSS PRODUCT S
- R Right OUTER Join S
- R Full OUTER Join S
These results have been determined considering generic tables without any given candidate keys involved.
Note: if candidate keys for a given table are given, then results will be different.
1. R UNION S
Reason : union we add all the tuples from both relations. i.e. 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
Reason : both relation contains same tuples then we may get maximum m keys
Reason : if no common tuples in both relations
3. R - S
Reason : if they are disjoint (if they have no element in common) 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
Reason : if they are disjoint (if they have no element in common) then in S-R we will get all tuples of S
Reason : m<n there will be some tuples in S after deleting the common tuples
5. R natural join S
Reason : if no matching key constraints, natural join will produce Cartesian product
Reason : Identical with case 2 (INTERSECTION).
6. R LEFT OUTER JOIN S
Reason : if all rows in left table matches with all rows in right table
- min: m (including every tuple from the left table)
Reason : if no tuple matches between the two table, but still we have to include all the tuples from the left table.
The minimum is 1 when m=1 , minimum is 2 when m=2, minimum is 0 when m=0
7. R / S
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
8. R CROSS PRODUCT S
Reason : combining each row in R with each row in S.
9. R RIGHT OUTER JOIN S
Reason : if all rows in left table matches with all rows in right table
- min: n (including every tuple from the right table)
Reason : if no tuple matches between the two table, but still we have to include all the tuples from the right table.
The minimum is 1 when n=1 , minimum is 2 when n=2, minimum is 0 when n=0
10. R FULL OUTER JOIN S
Reason : if all rows in left table matches with all rows in right table
Reason : if no tuple matches between the two table, but still we have to include all the tuples from the left & right table.
Reason : when every tuple in one of the table matches with tuples in other table.
elaborate explanation for min: max(m,n) for Full Outer Join:
Consider relation R with 4 tuples and S with 8 tuples.
So, min of outer join would be if there's no match. i.e m+n = 4+8 = 12 tuples.
but this is not the case to get absolute minimum.
To get min. in full outer join:
Consider, 4 out of 4 tuples in R matches with S's tuples (4 out 8 is same as R)
this time, resultant relation would have: 4(matched) + 4(unmatched) tuple = 8 tuples. (which is less than 12)