GateAI
Relational Model and SQL

GATE CSE 2021 Set 1 · Q23

NAT1 markMedium

Time

A relation r(A,B)r(A, B) in a relational database has 1200 tuples. The attribute AA has integer values ranging from 6 to 20, and the attribute BB has integer values ranging from 1 to 20. Assume that the attributes AA and BB are independently distributed. The estimated number of tuples in the output of σ(A>10)∨(B=18)(r)\sigma_{(A>10)\vee(B=18)}(r) is ________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 820 (±1) (±1)

Relational Model and SQL

Given:

  • Total number of tuples, N=1200N = 1200

  • A∈[6,20]A \in [6, 20], so the domain size of AA is 20−6+1=1520 - 6 + 1 = 15

  • B∈[1,20]B \in [1, 20], so the domain size of BB is 20−1+1=2020 - 1 + 1 = 20

  1. Selectivity of condition C1:(A>10)C_1: (A > 10):

    • Integer values satisfying A>10A > 10 are {11,12,…,20}\{11, 12, \dots, 20\}, which is 20−11+1=1020 - 11 + 1 = 10 values.

    • P(C1)=1015=23P(C_1) = \frac{10}{15} = \frac{2}{3}

  2. Selectivity of condition C2:(B=18)C_2: (B = 18):

    • Only 1 integer value satisfies B=18B = 18.

    • P(C2)=120P(C_2) = \frac{1}{20}

  3. Selectivity of condition C1∨C2C_1 \lor C_2 (independent attributes):

    P(C1∨C2)=P(C1)+P(C2)−P(C1)×P(C2)P(C_1 \lor C_2) = P(C_1) + P(C_2) - P(C_1) \times P(C_2)
    P(C1∨C2)=23+120−(23×120)=40+3−260=4160P(C_1 \lor C_2) = \frac{2}{3} + \frac{1}{20} - \left(\frac{2}{3} \times \frac{1}{20}\right) = \frac{40 + 3 - 2}{60} = \frac{41}{60}
  4. Estimated number of output tuples:

    Estimated tuples=N×P(C1∨C2)=1200×4160=20×41=820\text{Estimated tuples} = N \times P(C_1 \lor C_2) = 1200 \times \frac{41}{60} = 20 \times 41 = 820

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Relational Model and SQL previous year question is Q23 of the GATE CSE 2021 Set 1 paper. Find more GATE CSE PYQs on Relational Model and SQL in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Relational Model and SQL PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Relational Model and SQL in GATE CSE

Relational Model and SQL has 15 GATE CSE PYQs across 12 papers from 2011 to 2026. 2 of them are 1-mark NAT questions like this one, and it is the only one in GATE CSE 2021 Set 1.

How GATE tests Relational Model and SQL

More from GATE CSE 2021 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2021 Set 1 · Q23 · NAT

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 (A>10) (B=18)(r) is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.