411 views

1 Answer

0 votes
0 votes

They are asking equal number of minimum possible tuples retrieved.

Here the word minimum possible is very important.

Lets take an example:

                                                        Table P

Col1 Col2
1 2
3 4

                                                         Table Q

Col1 Col2
1 2

Note: I have assumed different number of tuples in each table as they have given

Now, query 1 and query 2 give the equal number of minimum tuples though they may not be same.

Query 3 will give 2 tuples which eliminates this option.

Lets turn to query 4.

I break the entire query in 3 parts.

Q41  exists  (  Q42  

                      except

                      Q43 )

Now, lets take the tables for this entire query.

                                      Table Q

B1 B2
1 2

                                        Table P

B1 B2 A1 A2
1 2 1 2
3 4 3 4

Lets move to execution of the entire query.

Now, Q41 selects the tuple (1,2,1,2) from table P.

When Q43 is executed, only the tuple (1,2) will be returned.

$\therefore$ Q42 except Q43 will return 0 tuples.

$\therefore$ Q41 will not select the tuple (1,2,1,2) as exists(0 tuples) is false.

Now, Q41 selects the tuple (3,4,3,4) from table P.

When Q43 is executed, only the tuple (3 ,4) will be returned.

$\therefore$ Q42 except Q43 will return tuple (1, 2).

$\therefore$ Q41 will select the tuple (3,4,3,4) as exists( 1 tuple ) is true.

Thus, execution of the entire query returned 1 tuple which matches with output of 1st and 2nd query.

Hence, option C.

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

This is just a possibilty.  Its possible that query 4 returns 0 tuples if both the tables, P and Q,  contain same tuples. So, as per this, even option A is correct.

For the 4th query, they should give that both tables contain different tuples.

Related questions

1 votes
1 votes
0 answers
1
1 votes
1 votes
1 answer
3
Shivam Kasat asked Dec 19, 2018
531 views
the table “Sales89” contains information about the address,zip,sale-date,price and inflamation-adjusted “real-price” of 222 sales of single family homes in calcut...