in Databases edited by
1,417 views
1 vote
1 vote

Consider a relation R(A, B) that contain r tupples, and a relation S(B, C) that contains s tupples; assume r > 0 and s > 0. Make no assumption about keys. For the relational algebra expression what can be the minimum and the maximum number of tupples that could be in the result of expression in term of r and s.

A) Min:0,Max:r+s

B) Min:r+s,Max:r*s

C) Min:max(r,s),Max:r+s

D) Min:0,Max:r*s

in Databases edited by
by
1.4k views

4 Comments

is ans option c?
1
1
yes,explain
0
0
@srestha explained
0
0

3 Answers

1 vote
1 vote
C)

Min = max(r,s) if both tables have same tuples and if either one has more tuples than the other one those will be added as well hence max.

Max = r+s when both tables are different.
edited by
1 vote
1 vote

 MIN IS POSSIBLE  WHEN  TUPLES ARE REPEATED.

 MAX IS POSSIBLE  WHEN TUPLES ARE DIFFERENT.

edited by

4 Comments

R has 3 tuple, S has 3 tuple

Max should be3+3=6 tuples rt?
0
0
Consider MIN case in pic, R(3 tuples) U S(3tuples) then

RUS has max(3,3) ====>3 tuples [3 is maximum number among those two]

R(3 tuples) U S(1 tuple) then

RUS has max(3,1) =====>3 tuples[3 is maximum number among those two]
0
0
Not getting ur concept clearly
0
0
As union operation eliminates duplicates then to get minimum number of tuples we should see that both the tables have repeated tuples (Like in  PIC).

I have took two examples for minimum case in PIC i got max of two tables (See in pic and above explanation).
0
0
1 vote
1 vote

CASE 1:

Here in case 1 i am making 2 tables with not a single column common between them.

imagine a relation "HarryPotter" with 1 attribute "house " and another attribute "category" and containing 4 tuples.

HarryPotter

Houses Category
Gryffindor Movie
Hufflepuff Movie
Slytherin Movie
Ravenclaw Movie

imagine a relation "Game of Thrones" with 1 attribute "house " and another attribute "category" containing 3 tuples

Game of Thrones

Houses Category
Stark Tv series
Lannister Tv series
Targaryan Tv series

what happens when you unify them?

Houses Category
Gryffindor Movie
Hufflepuff Movie
Slytherin Movie
Ravenclaw Movie
Stark Tv series
Lannister Tv series
Targaryan Tv series

You get (4+3) = 7 tuples----> max:(m+n) where m=4 and n=3.

CASE 2

Here i  make 2 tables with tuples common between them.

Table 1:

Houses Category
Gryffindor Movie
Hufflepuff Movie
Stark Tv series

 

Table 2:

Houses Category
Gryffindor Movie
Hufflepuff Movie
Stark Tv series
Lannister Tv series
Targaryan Tv series

When you unify them you get.What happens when you unify Table 1 and Table2?

Notice here 3 tuples are getting repeated.We consider them only once. So whats the result?

Houses Category
Gryffindor Movie
Hufflepuff Movie
Stark Tv series
Lannister Tv series
Targaryan Tv series

see Table 1 had 3 tuples and Table 2 had 5 tuples, End result 5 tuples-->min is max(5,3) = 5.

ps: although I believe in some cases  it can be more than 5, but here our objective is to find the closest appropriate answer.

1 comment

yes it is a concept of duplicate tuples
0
0