Consider the following two relations, R(A,B) and S(A,C): R A B 10 20 20 30 30…

2024

Consider the following two relations, R(A,B) and S(A,C):

       R             

A              B           

10            20           

20            30           

30            40           

30            50           

30            95

         S           

 A             C           

10            90           

30            45           

40            80

The total number of tuples obtained by evaluating the following expression        

image.png

is _________

Attempted by 73 students.

Show answer & explanation

Correct answer: 2

Key idea: join R and S on A, then count joined tuples where B < C.

  • A = 10: R has (10,20) and S has (10,90) → joined tuple (10,20,90). 20 < 90, so this contributes 1 tuple.

  • A = 30: R has (30,40), (30,50), (30,95) and S has (30,45). Joined tuples are (30,40,45), (30,50,45), (30,95,45). Only 40 < 45 holds, so this contributes 1 tuple.

  • Other A values produce no matching pairs, so they contribute 0 tuples.

Total number of tuples satisfying B < C after the join: 2

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir