patternMinor
Minimum and Maximum Number of Tuples
Viewed 0 times
numbermaximumminimumandtuples
Problem
Consider Relations R and S where are R is having m tuples and S is having n tuples . m
My Work
max : n+m ( union we add all the tuples from both relations)
min: 0 ( taking m=n=null )
max : m ( m
max : m ( if they are disjoint then in R-S we will get all tuples of R )
min: 0 ( if all tuples in R is also present in S)
max : n ( as explained above )
min: 0 ( as explained above )
max : n*m ( if no matching key constraints natural join will produce Cartesian product )
min: m ( m
max : m ( everything from left table will be output even if no match)
min: 0 ( when m=0 )
max : m ( when n=0 )
min: Im Not able to make a conclusion
- R intersection S
- R-S
- S-R
- R NATURAL JOIN S
- R Left OUTER Join S
- R/S
My Work
- R UNION S
max : n+m ( union we add all the tuples from both relations)
min: 0 ( taking m=n=null )
- R INTERSECTION S
max : m ( m
max : m ( if they are disjoint then in R-S we will get all tuples of R )
min: 0 ( if all tuples in R is also present in S)
- S-R
max : n ( as explained above )
min: 0 ( as explained above )
- R natural join S
max : n*m ( if no matching key constraints natural join will produce Cartesian product )
min: m ( m
max : m ( everything from left table will be output even if no match)
min: 0 ( when m=0 )
- R/S
max : m ( when n=0 )
min: Im Not able to make a conclusion
Solution
Yes, your answers are mostly right, except a few mistakes:
-
max : n+m ( union we add all the tuples from both relations)
Correct, when R and S have no common tuple.
-
min: 0 ( taking m=n=null )
Wrong, the minimum is
And m and n cannot be null, they are the sizes of the relations, they are numbers (integers).
-
max : m (
R UNION S
-
max : n+m ( union we add all the tuples from both relations)
Correct, when R and S have no common tuple.
-
min: 0 ( taking m=n=null )
Wrong, the minimum is
n (the greatest of the two sizes, m and n). When all the tuples of R also exist in S.And m and n cannot be null, they are the sizes of the relations, they are numbers (integers).
R INTERSECTION S
-
max : m (
m
-
min: 0 ( taking m=n=null if no common keys in both relations)
Correct but the reasoning is wrong. The result can be 0 because the two relations may have no common tuples).
R - S
-
max : m ( if they are disjoint then in R-S we will get all tuples of R )
Correct
-
min: 0 ( if all tuples in R is also present in S)
Correct
S - R
-
max : n ( as explained above )
Correct
-
min: 0 ( as explained above )
Wrong, the minimum is n - m.
R natural join S
-
max : n*m ( if no matching key constraints natural join will produce Cartesian product )
Correct
-
min: m ( m
R LEFT OUTER JOIN S
-
max : m ( everything from left table will be output even if no match)
Wrong, the maximum is m * n, the same as for natural join. Or just take ON TRUE.
-
min: 0 ( when m=0 )
Wrong, the minimum is m. Example can be the same as for NATURAL join above (or just take ON FALSE) but it cannot give as a result lees than the number of tuples in R (the left relation in the join).
R / S
-
max : m ( when n=0 )
Correct but it doesn't have to be n=0 or m=0. You can find another example.
-
min: I'm not able to make a conclusion.
Minimum is 0 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.Context
StackExchange Database Administrators Q#160241, answer score: 4
Revisions (0)
No revisions yet.