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: 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…
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:
(p, q, r, n)
(p, q, r, a)
(p, q, r, b)
(m, q, r, n)
(m, q, r, a)
(m, q, r, b)
(d, e, f, g)