How many records will the cartesian product operation produce?
Question:
5. Assume relations R and S with tuples 10 and 5 respectively. How many records will be there in the result of the operation R X S (i.e., R cartesian product S)?
(a) 10 records
(b) 5 records
(c) 50 records
(d) 15 records
Answer:
(c) 50
R X S will include every tuple of R with every tuple of S and produce a redundant number of records. Refer the example given below;
R


A

B

C


Tuple 1

a1

b1

c1

Tuple 2

a2

b2

c2

Tuple 3

a3

b3

c3

S


B

D


Tuple 1

b1

d1

Tuple 2

b2

d3

R
X S


A

R.B

C

S.B

D


Tuple 1

a1

b1

c1

b1

d1

Tuple 2

a1

b1

c1

b2

d3

Tuple 3

a2

b2

c2

b1

d1

Tuple 4

a2

b2

c2

b2

d3

Tuple 5

a3

b3

c3

b1

d1

Tuple 6

a3

b3

c3

b2

d3

No comments:
Post a comment