Consider the following relations X(S, Si, C) and Y(S, P, D) . Find the number…

2023

Consider the following relations X(S, Si, C) and Y(S, P, D) .

Find the number of tuples by applying the operation \(X ⟕ \ _{\text{x.s} = y.\text{s}} Y\)

  1. A.

    1    

  2. B.

    3

  3. C.

    4

  4. D.

    6

Attempted by 266 students.

Show answer & explanation

Correct answer: C

Key idea: a left outer join returns all rows from the left relation X and matches rows from Y when the join condition holds; if no match exists, Y's attributes are NULL.

  • Rows in X (S, Si, C): J,1,M | B,2,N | R,3,H | T,4,G

  • Rows in Y (S, P, D): J,S1,CA | B,P1,AB | R,D1,DC | A,H1,MD

  • Match each row of X to rows of Y on S:

  • J from X matches J in Y → result tuple: J, 1, M, S1, CA

  • B from X matches B in Y → result tuple: B, 2, N, P1, AB

  • R from X matches R in Y → result tuple: R, 3, H, D1, DC

  • T from X has no matching S in Y → result tuple: T, 4, G, NULL, NULL

Total number of tuples in X ⟕_{x.s = y.s} Y: 4

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

Explore the full course: Mppsc Assistant Professor