Select Page
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

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 [Reason:] 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 [Reason:] 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

Answer: c [Reason:] 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 [Reason:] 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 [Reason:] 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 [Reason:] 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.

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

```(SELECT studentid
FROM student
WHERE SECTION = 'c')
EXCEPT
(SELECT studentid
FROM student
WHERE roll &lt;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 [Reason:] 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