GATE 2021 CS (CS1) – Question 33
A relation $r(A, B)$ in a relational database has 1200 tuples. The attribute $A$ has integer values ranging from 6 to 20, and the attribute $B$ has integer values ranging from 1 to 20. Assume that the attributes $A$ and $B$ are independently distributed. The estimated number of tuples in the output of $\sigma_{(A>10) \vee (B=18)}(r)$ is ______.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 819 to 820
Explanation
$A$ takes the integers $6,\dots,20$: that is 15 values. $B$ takes $1,\dots,20$: 20 values. $A$ and $B$ are independent, so the selectivities multiply.
- $P(A>10)$: values 11 to 20, which is 10 values, so $P=\tfrac{10}{15}=\tfrac23$.
- $P(B=18)=\tfrac1{20}$.
For a disjunction of independent conditions:
$$P(A>10\ \vee\ B=18)=\tfrac23+\tfrac1{20}-\tfrac23\cdot\tfrac1{20}=\tfrac{40+3-2}{60}=\tfrac{41}{60}\approx0.6833.$$
Estimated tuples $=1200\times\tfrac{41}{60}=\mathbf{820}$.
More Relational Model: Relational Algebra, Tuple Calculus, SQL questions
- GATE 2021 CS (CS1) Q37
- GATE 2020 CS Q23
- GATE 2019 CS Q61
- GATE 2019 CS Q65
- GATE 2018 CS Q22
- GATE 2018 CS Q51
All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →