1,458 views
4 votes
4 votes
In the following relational algebra expressions, assume union and difference are multi set operators and the relations R(x),S(x) and T(x) are multi sets.

Q1:(R U S)-T

Q2:(R - T)U(S - T)

(A) Q1 and Q2 produce the same answer

(B) The answer to Q1 is always contained in the answer to Q2

(C) The answer to Q2 is always contained in the answer to Q1

(D) They produce complete different answers

what is the answer ,please explain or give example.

3 Answers

3 votes
3 votes
The answer is (C).

First we show that Q2 $\subseteq$ Q1. Lets consider some examples.

  R                                        S                                              T

-------------------------------------------------------------------------------------------------

1  1                                   1  2                                       2   1

1  2                                   2  1                                       2   2

2  1                                   2  2                                       2   3

 

Q1: (1,1) (1,2) (1,2) (2,1)

Q2: (1,1) (1,2) (1,2)

Hence, proved.

-------------------------------------------------------------------

Now, we disprove that Q1 $\subseteq$ Q2 is ever possible.

Q1 is subtracting T only once while Q2 is subtracting T twice. So, possiblity of having tuples in Q1 more than Q2 is necessarily more than Q2.

Hence, Q1 $\subseteq$ Q2 is never possible.

------------------------------------------------------------------

Hence, answer (C).

Related questions

2 votes
2 votes
2 answers
1
indrajeet asked Sep 23, 2016
3,326 views
Consider the following entity relation diagramIf A has 50 entities,B has 20 entities and C has 200 entities. what is the maximum number of triples of entities that could ...
0 votes
0 votes
1 answer
2
aditya kuppa 1 asked Dec 5, 2017
1,089 views
How many minimum tables are required for this er diagram consisting of a many - many relation and total participation of one of the entities.? Can't i merge relation R an...
0 votes
0 votes
0 answers
3
Beyonder asked Nov 30, 2016
724 views
Can Anyone Explain how Query 28 works with example.
6 votes
6 votes
1 answer
4
indrajeet asked Sep 22, 2016
789 views
Consider the following table MysteryMysteryAB1Null2435Null6select count() from Mysterywhere A not in( select B from Mystery)(A) 1(B) 0(C) 4(D) 3ans is B givenplease expla...