Project ForgeSign up free
Database Management Systems
Relational Algebra
GATE 2012
Expert

Consider the following relations A, B and C:

A(Id,Name,Age): (12,Arun,60), (15,Shreya,24), (99,Rohit,11) B(Id,Name,Age): (15,Shreya,24), (25,Hari,40), (98,Rohit,20), (99,Rohit,11) C(Id,Phone,Area): (10,2200,02), (99,2100,01)

How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A∪B is the same as that of A.

(A∪B) ⋈ [A.Id > 40 ∨ C.Id < 15] C

  • 7
  • B4
  • C5
  • D9

Explanation

A∪B (deduplicated) has 5 distinct tuples with Ids {12,15,99,25,98}. C has 2 tuples with Ids {10,99}. The theta-join condition is (A∪B).Id > 40 ∨ C.Id < 15, evaluated over all 5×2=10 pairs. When C.Id=10 (< 15), the condition is true regardless of the other side's Id — giving 5 matching pairs. When C.Id=99 (not < 15), the condition reduces to (A∪B).Id > 40, true only for Id=99 and Id=98 — giving 2 more pairs. Total = 5 + 2 = 7 tuples.

Source: GATE CS 2012 (2012)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free