The GATE Grind

GATE 2021 CS (CS1) – Question 33

Databases · Relational Model: Relational Algebra, Tuple Calculus, SQL · 1 mark · Numerical answer

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.

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

All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →