Consider the following relations r1 and r2: Identify the number of tuples in…

Consider the following relations r1 and r2:

Identify the number of tuples in the relation r1⋈r2

Answer: 7Key idea: Perform a natural join on the common attributes Q and R; for each matching pair of Q and R, combine rows from both relations. Rows of the first…

Attempted by 18 students.

Show answer & explanation

Correct answer: 7

Key idea: Perform a natural join on the common attributes Q and R; for each matching pair of Q and R, combine rows from both relations.

  • Rows of the first relation (P, Q, R): (p, q, r), (k, i, j), (m, q, r), (d, e, f).

  • Rows of the second relation (Q, R, S): (q, r, n), (l, c, o), (q, r, a), (q, r, b), (e, f, g).

Find matching (Q, R) pairs and multiply counts:

  • For (q, r): the first relation has 2 rows (p, q, r) and (m, q, r); the second relation has 3 rows with (q, r). These produce 2 × 3 = 6 joined tuples.

  • For (e, f): the first relation has 1 row (d, e, f) and the second relation has 1 row (e, f, g). These produce 1 × 1 = 1 joined tuple.

Total number of tuples in the join: 6 + 1 = 7.

The resulting joined tuples (P, Q, R, S) are:

  1. (p, q, r, n)

  2. (p, q, r, a)

  3. (p, q, r, b)

  4. (m, q, r, n)

  5. (m, q, r, a)

  6. (m, q, r, b)

  7. (d, e, f, g)

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…