The estimated number of tuples in the output of is ____________.
GATE CSE 2021Databases › SQLVerified
GATE CSE 2021 PYQ: A relation r ( A , B ) r(A, B) r ( A , B ) in a relational database has 1200 1200 1200 tuples. The attribute…
Answer
820
Approach
Use relational query selectivity estimation with inclusion-exclusion. Assume uniform distribution over the domains of A and B and independence. The expected output cardinality is the original tuple count times the probability that a randomly selected tuple satisfies the selection predicate.
The standard selectivity estimation formula gives 820. The alternative 205 arises only if one enforces strict set semantics and first deduplicates the relation to at most 15×20 = 300 distinct (A,B) pairs, then applies the condition to those distinct tuples. However, the problem states that the relation has 1200 tuples and asks for an estimated query output cardinality, which in database query optimization assumes multiset/bag behavior (SQL table). Thus the expected answer is 820.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.