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
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
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
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.
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
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
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.
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
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
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.
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
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
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
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.