Consider the following relation How many tuples will be result of following…

Consider the following relation

How many tuples will be result of following relation

Answer: 4Expression: (STUDENT ⨝ (AGE ≥ 25 ∧ STUDENT.SID = RESERVES.SID) RESERVES) ⨝ GATEEXAM Step-by-step reasoning: Apply the AGE ≥ 25 selection on STUDENT: keep…

Attempted by 4 students.

Show answer & explanation

Correct answer: 4

Expression: (STUDENT ⨝ (AGE ≥ 25 ∧ STUDENT.SID = RESERVES.SID) RESERVES) ⨝ GATEEXAM

Step-by-step reasoning:

  • Apply the AGE ≥ 25 selection on STUDENT: keep students with SID = 12 (age 25), 15 (age 33), 16 (age 32), 25 (age 28).

  • Join these selected STUDENT rows with RESERVES on SID. Matching RESERVES rows are:

    • SID 12, GATEID 101, EXAM DATE 28/2/14

    • SID 15, GATEID 101, EXAM DATE 28/2/14

    • SID 25, GATEID 102, EXAM DATE 1/3/14

    • SID 16, GATEID 103, EXAM DATE 2/3/14

    • SID 12, GATEID 104, EXAM DATE 1/3/14

    After this join there are 5 intermediate tuples (one student can appear multiple times if they have multiple reservations).

  • Now join with GATEEXAM on GATEID. GATEEXAM contains GATEID values 101, 102, 103. The RESERVES row with GATEID 104 has no match and is eliminated.

  • Remaining joined tuples (final result):

    • SID 12, GATEID 101, EXAM DATE 28/2/14

    • SID 15, GATEID 101, EXAM DATE 28/2/14

    • SID 25, GATEID 102, EXAM DATE 1/3/14

    • SID 16, GATEID 103, EXAM DATE 2/3/14

    Total tuples in the final result: 4.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…