RDBMS Questions and Answers – Basic Operations

This set of RDBMS Multiple Choice Questions & Answers (MCQs) focuses on “Basic Operations”.

1. Which of the following syntax of the basic query is correct?
a) select <relation> from <attribute>
b) select <attribute> from <elation>
c) select <tuple> from <relation>
d) select <tuple> from <attribute>
View Answer

Answer: b
Explanation: The select clause is used to select a specific attribute from a given relation. So, the syntactically correct statement is select <attribute> from <relation>.

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
Explanation: 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: d
Explanation: “not” is not a logical connective included in the SQL. The and, or and nor are logical connectives that are included in SQL.
advertisement
advertisement

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
Explanation: The “from” clause contains the attribute names on which the “which” clause can be used on.

5. select distinct dept_name
from institute;

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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
Explanation: 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
Explanation: student.branch = department.branch verifies whether both the values of the attributes are same in both the relations and returns the value.
advertisement

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
Explanation: 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
Explanation: 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.
advertisement

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

Answer: b
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: 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: b
Explanation: 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.

Sanfoundry Global Education & Learning Series – RDBMS.

To practice all areas of RDBMS, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.