SQL Questions and Answers – SQL Select Statement

This set of SQL Multiple Choice Questions & Answers (MCQs) focuses on “SQL Select Statement”.

1. SELECT statement retrieves _________
a) Records from only one table
b) Records from one or more tables
c) Data from only one column
d) Data from only one row
View Answer

Answer: b
Explanation: Select statement selects records from one or more tables. Fetched records may contain any number of rows and columns based on other statements.

2. Which character in the select clause denotes “ALL ATTRIBUTES”?
a) +
b) %
c) *
d) _
View Answer

Answer: c
Explanation: SELECT * is used to retrieve all columns of a table. SELECT * FROM t_name. This statement retrieves all the fields of the table t_name.

3. Where the data retrieved by SELECT statement is stored?
a) Data table
b) Data set
c) Result set
d) Database table
View Answer

Answer: c
Explanation: The SELECT statement is used to retrieve data from a database. The data retrieved by a SELECT clause is stored in a result table, called as result-set.
advertisement
advertisement

4. What is the syntax for SELECT statement?
a) SELECT table_name FROM database_name;
b) SELECT column_list FROM table_name;
c) SELECT row_list FROM table_name;
d) SELECT record_list FROM table_name;
View Answer

Answer: b
Explanation: Column_list includes one or more columns from which data is retrieved.

SELECT column_list FROM TABLE_NAME;

retrieves all columns of column_list from table_name.

5. Which statement(s) are mandatory in a simple SQL SELECT statement?
a) Select, Where
b) Select, OrderBy
c) Select, From
d) Select, GroupBy
View Answer

Answer: c
Explanation: From statement contains the table name from which the required columns are to be retrieved. So it is necessary along with Select statement, whereas others are optional.
advertisement

6. To create a simple SQL SELECT statement, which of the following are necessary?
a) Column name, Row name
b) Column name, Table name
c) Row name, Table name
d) Column name
View Answer

Answer: b
Explanation: We must specify a list of column names and the table names of those columns to create a simple SQL SELECT statement. These column names are also known as fields, attributes.

7. Arithmetic expressions cannot be used in Select clause.
a) True
b) False
View Answer

Answer: b
Explanation: Whenever we need to perform calculations in SQL statement, we can use arithmetic expressions in Select clause. An expression can contain column names, numeric numbers and arithmetic operators.
advertisement

8. SELECT clause corresponds to __________
a) Projection operation of Relational algebra
b) Selection operation of Relational algebra
c) Cartesian Product of Relational algebra
d) Join operation of Relational algebra
View Answer

Answer: a
Explanation: Select corresponds to Projection, from corresponds to Selection and where corresponds to cartesian product operations of Relational algebra.

9. Consider the relation:

Instructor (Id, Salary);

Which of the following query retrieves the total salary of all instructors after receiving a bonus of 200/-?
a) Select Salary From instructor
b) Select Salary+200 From instructor+200
c) Select Salary+200 From instructor
d) Select Salary From instructor+200
View Answer

Answer: c
Explanation: An expression can contain column names, numeric numbers and arithmetic operators. It cannot be used with table name. “Select Salary+200 From instructor” returns Salary from Instructor table which is increased by an amount of 200/-.

10. SELECT eliminates duplicate rows by default.
a) True
b) False
View Answer

Answer: b
Explanation: Select retrieves data without eliminating duplicates.
A key word named distinct has to be used along with select statement to eliminate duplicates.

Sanfoundry Global Education & Learning Series – SQL.

To practice all areas of SQL, 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.