250+ TOP MCQs on Set Operations and Answers

RDBMS Multiple Choice Questions on “Set Operations”.

1. What is the function of the union operation?
a) It combines the results of any two different queries
b) It combines the results of two different queries which have the same set of attributes in the select clause
c) It combines the results of two different queries which have the same condition in the where clause
d) It gives the Cartesian product of the results of any 2 queries

Answer: b
Clarification: The union operation combines the results of two different queries which have the same set of attributes in the select clause. It automatically eliminates duplicates.

2. What is the function of the intersect operation?
a) It returns the intersection of the results of the results of any two different queries
b) It returns the intersection of the results of two different queries which have the same set of attributes in the select clause
c) It returns the intersection of the results of two different queries which have the same condition in the where clause
d) None of the mentioned

Answer: b
Clarification: The intersect operation returns the intersection of the results of the results of two different queries which have the same set of attributes in the select clause. It automatically eliminates duplicates.

3. What is the function of the except operation?
a) It excludes all the results present in both the queries
b) It includes the results of the second query but excludes the results of the first query
c) It includes the results of the first query but excludes the results of the second query
d) It includes all the results of both queries but removes duplicates

  250+ TOP MCQs on Dynamic Hashing and Answers

Answer: c
Clarification: The except operation includes the results of the first query but excludes the results of the second query. It automatically eliminates duplicates but if we want to retain duplicates we must use except all in place of except.

4. When does the predicate is null succeed?
a) If the value on which it is applied is finite
b) If the value on which it is applied is invalid
c) If the value on which it is applied is blank
d) If the value on which it is applied is more than the allowed limit

Answer: c
Clarification: The is null predicate succeeds when the value on which it is applied is blank/null.

5. Using the _______ clause retains only one copy of identical tuples
a) distinct
b) is not null
c) no repeat
d) from

Answer: a
Clarification: Specifying the distinct clause beside the select clause retains only one copy of identical tuples resulting from the query.

6. Observe the following query and choose the correct option

SELECT DISTINCT name 
FROM student
WHERE ID IS NOT NULL;

a) The query is syntactically wrong
b) The query gives all the possible student names where a finite value exists for ID
c) The query gives the names of the students that have a null ID and it also excludes identical names
d) The query gives the student names where a finite value exists for ID and it excludes identical names

Answer: d
Clarification: The distinct keyword is used to remove tuples that have identical values. The is not null clause checks only for ID’s that are not null values.

  250+ TOP MCQs on Bitmap Indices and Answers

7. What will be the result of the following query?

(SELECT studentid
FROM student 
WHERE SECTION = 'c')
EXCEPT
(SELECT studentid
FROM student
WHERE roll <10);

a) All the values of the studentid for which section is c and roll < 10
b) All the values of the studentid for which section is c and roll > 10
c) All the values of the studentid for which section not c and roll < 10
d) All the values of the studentid for which section not c and roll > 10

Answer: b
Clarification: The except operation excludes all the tuples that are present in the result of the second query from the result of the first query. It also excludes all duplicates from the relation.

8. Which of the following correctly describes the between predicate in the where clause?
a) It is used to check whether a value is in between two specified values
b) It is used to check whether a value is exactly in the center of the relation alphabetically
c) It is used to check whether a value is in between any two other values in the database
d) None of the mentioned

Answer: a
Clarification: The between predicate in the where clause is used to check whether a value is in between two externally specified values. This clause is used to list out all tuples having a value within a range.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top