Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

UGC-NET | UGC NET CS 2016 Aug – III | Question 11

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Consider the following ORACLE relations :
One (x, y) = {<2, 5>, <1, 6>, <1, 6>, <1, 6>, <4, 8>, <4, 8>}
Two (x, y) = {<2, 55>, <1, 1>, <4, 4>, <1, 6>, <4, 8>, <4, 8>, <9, 9>, <1, 6>}
Consider the following two SQL queries SQ1 and SQ2 :

SQ1 : SELECT * FROM One)
           EXCEPT
      (SELECT * FROM Two);
SQ2 : SELECT * FROM One)
        EXCEPT ALL
      (SELECT * FROM Two);

For each of the SQL queries, what is the cardinality (number of rows) of the result obtained when applied to the instances above ?
(A) 2 and 1 respectively
(B) 1 and 2 respectively
(C) 2 and 2 respectively
(D) 1 and 1 respectively


Answer: (B)

Explanation: SQ1 : SELECT * FROM One)
EXCEPT
(SELECT * FROM Two);
It will result into single tuple (2, 5) because all duplicate tuples will be removed.
SQ2 : SELECT * FROM One)
EXCEPT ALL
(SELECT * FROM Two);
It will result into 2 tuples <(2,5), (1.6)> because it will not remove duplicate.
So, option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 16 Apr, 2018
Like Article
Save Article
Similar Reads