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. Which of the following syntax of the basic query is correct?
a) select from
b) select from
c) select from
d) select from

View Answer

Answer: b [Reason:] The select clause is used to select a specific attribute from a given relation. So, the syntactically correct statement is “select from .

2. Which of the following keywords is used beside the select clause to explicitly specify that duplicates are not removed?
a) all
b) not unique
c) notnull
d) include

View Answer

Answer: a [Reason:] The “all” keyword is used beside the select clause to explicitly specify that duplicates are not removed.

3. Which of the following logical connectives is not included in SQL?
a) and
b) or
c) nor
d) not

View Answer

Answer: c [Reason:] “not” is not a logical connective included in the SQL. The and, or and nor are logical connectives that are included in SQL.

4. The where clause is a predicate involving attributes of the relation in the ______ clause.
a) select
b) from
c) with
d) none of the mentioned

View Answer

Answer: b [Reason:] The “from” clause contains the attribute names on which the “which” clause can be used on.

5. select distinct dept_name
from institute;

What does the above query do?
a) It gives all the tuples having a distinct dept_name
b) It gives the dept_name attribute values of all tuples without repetition
c) It gives all the dept_name attribute of all the tuples
d) It gives all the tuples having a null value under the dept_name attribute

View Answer

Answer: b [Reason:] The distinct keyword is used to explicitly force the elimination of duplicate tuples. Thus, the above query excludes duplicates.

6. What does the following query do?
select name, ID, branch
from student, department
where student.branch = department.branch;
a) It gives all values of name, ID, branch from both the relations only if all those attributes are present in both
b) It gives all values of name, ID, branch from their respective relations
c) It gives the values of name, ID, branch from their respective relations where the values in the branch attribute are same
d) It gives the values of name, ID, branch from their respective relations where all the values are matching with each other

View Answer

Answer: c [Reason:] student.branch = department.branch verifies whether both the values of the attributes are same in both the relations and returns the value.

7. The ________ clause is used to list the attributes desired in the result of a query
a) select
b) from
c) where
d) create

View Answer

Answer: a [Reason:] The select clause is used to list the attributes desired in the result of a query.

8. If we specify multiple relations in the from clause and do not specify any conditions in the where clause, what will the result be?
a) The natural join of both the relations
b) The left outer join of both the relations
c) A syntactical error
d) The Cartesian product of both the relations

View Answer

Answer: d [Reason:] If we specify multiple relations in the from clause and do not specify any conditions in the where clause, the default definition given by the from clause is the Cartesian product of the relations listed in the clause. So it returns all the possible combinations of the tuples of the two relations.

9. State true or false: Multiple conditions in the where clause are separated by a “,”
a) True
b) False

View Answer

Answer: b [Reason:] Multiple conditions in the where clause are separated by the “and” keyword.

10. What does the natural join operation do?
a) It considers only those pairs of tuples that have the same value on those attributes that appear in the schemas of both relations
b) It considers only those pairs of tuples that have the same value on at least one of the attributes that appear in the schemas of both the relations
c) It considers only those pairs of tuples that do not have the same value on those attributes that appear in the schemas of both relations
d) None of the mentioned

View Answer

Answer: a [Reason:] The natural join operation considers only those pairs of tuples that have the same value on those attributes that appear in the schemas of both the relations. The natural join operation operates on 2 relations and gives a relation as the result.

11. Observe the following query and choose the correct option.
select name, ID
from student natural join department natural join section
a) The query is syntactically wrong because there is no where clause
b) The query is syntactically wrong because there are more than one attributes in the select clause
c) The query is syntactically wrong because more than one relations are included in the natural join operation
d) The query is correct

View Answer

Answer: d [Reason:] The query is syntactically correct because, where clause is not necessary in a query, more than one attributes can be specified in the select clause and more than one relations may be operated on, using the natural join operator.

12. Which keyword is used to rename a relation in a query?
a) rename
b) as
c) is
d) to

View Answer

Answer: b [Reason:] The “as” keyword is used to rename a relation in a query. This is used for convenience as long relation names can reduce readability.

13. While operating with strings, what does “_ _ _%” match with?
a) A string of three letters
b) A string of at least three letters
c) A string of three words
d) A string of at least three words

View Answer

Answer: a [Reason:] The string in the question matches with a string having at least three letters. The first three blank spaces indicate three letters whereas the percentage indicates indefinite spaces after that.