Consider the following relational schemas: And the instances (snapshots) of…

Consider the following relational schemas:

And the instances (snapshots) of the above schemas: 

Consider the following relational algebra query is executed on the above instance: 


The number of rows return by above query is ________.


Answer: 3Step 1: Select red and green boatsFrom Boats table: Red boats → 102, 104 Green boats → 103 So, Tempboats = {102, 103, 104} Step 2: Join with Reserves Keep…

Attempted by 5 students.

Show answer & explanation

Correct answer: 3

Step 1: Select red and green boats

From Boats table:

Red boats → 102, 104
Green boats → 103

So, Tempboats = {102, 103, 104}


Step 2: Join with Reserves

Keep only reservations where bid ∈ {102, 103, 104}

Matching rows:

  • 22 → 102, 103, 104

  • 31 → 102, 103, 104

  • 64 → 102

  • 74 → 103

Total matching rows = 8

Step 3: Join with Sailors (get names)

  • 22 → Dustin

  • 31 → Lubber

  • 64 → Horatio

  • 74 → Horatio

Names obtained (including duplicates):

Dustin (3 times)
Lubber (3 times)
Horatio (2 times)

Step 4: Apply projection π_sname

Projection removes duplicates.

Distinct names:

  • Dustin

  • Lubber

  • Horatio

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…