250+ TOP MCQs on The select Clauses and Answers

MySQL Multiple Choice Questions on “The select Clauses”.

1. Which among the following can also be included with “SELECT” clause while writing query in Mysql?
a) Literals
b) Expressions
c) User defined functions
d) All of the mentioned

Answer: d
Clarification: “SELECT clause” can also include Literals like ‘ACTIVE’, Expressions like emp_id*314, Built_in functions like UPPER ().

2. Is there any error in executing the following MySQL command?

SELECT emp_id, ‘ACTIVE’,
       emp_id * 3.145,
       UPPER (lname)
       FROM Employee;

a) Yes
b) NO
c) Depends on condition
d) None of the mentioned

Answer: b
Clarification: “SELECT clause” includes the following: Literals like ‘ACTIVE’, Expressions like emp_id*314, Built_in functions like UPPER ().

3. Is there any error in executing the following MySQL command?

SELECT USER (),
VERSION (), DATABASE ();

a) Yes, “FROM” is not used
b) No
c) Depends
d) None of the mentioned

Answer: b
Clarification: Clause “FROM” is not necessary when we used “Built in” function with “SELECT” clause.

4. What is the need of “column Aliases” in “SELECT” clause?
a) To assign a new label to the column in result set
b) To overwrite the existing column name in result set
c) To modify the column name while using literals, Expression, built_in functions with “SELECT clause
d) All of the mentioned

Answer: d
Clarification: “Column Aliases” are used to assign a new label to the columns in the result set without actually changing the column name.

5. What will be the result of the following MySQL command?

SELECT emp_id,
‘ACTIVE’ STATUS,
emp_id * 3.14 emp_pi,
UPPER (lname) last_name
FROM employee;

a) emp_id, ACTIVE, emp_id * 314, UPPER(lname)
b) emp_id, Status, emp_pi, last_name
c) Error
d) None of the mentioned

  250+ TOP MCQs on Setting Up Replication Servers and Answers

Answer: b
Clarification: Status, emp_pi, last_name are “column aliases”.

6. What will be the result of the following MySQL command?

SELECT emp_id,
‘ACTIVE’ AS STATUS,
emp_id * 3.14 AS emp_pi,
UPPER (lname) AS last_name
FROM employee;

a) emp_id, ACTIVE, emp_id * 314, UPPER(lname)
b) emp_id, Status, emp_pi, last_name
c) Error
d) None of the mentioned

Answer: b
Clarification: Status, emp_pi, last_name are “column aliases” and Keyword “AS” is optional.

7. Which Keyword is used to remove duplicate rows in the result set?
a) DISTINCTS
b) MODIFY
c) DISTINCT
d) All of the mentioned

Answer: a
Clarification: None.

8. If in Table “account”, a column “cust_id” consists of {1,2,2,3,3,5,6,7,8,8} then what will be the output on executing the following MySQL statement?

SELECT DISTINICT cust_id
FROM account;

a) {1, 2, 2, 3, 3, 5, 6, 7, 8, 8}
b) {1, 2, 3, 5, 6, 7, 8}
c) { }
d) None of the mentioned

Answer: b
Clarification: DISTINICT keyword will remove the duplicate entries in the result set.

9. If in Table “employee”, a column “emp_id” consists of {1,2,2,3,3,5,6,7,8,8} then what will be the output on executing the following MySQL statement?

SELECT DISTINICT emp_id
FROM employee;

a) {1,2,2,3,3,5,6,7,8,8}
b) {1,2,3,5,6,7,8}
c) { }
d) None of the mentioned

Answer: b
Clarification: DISTINICT keyword will remove the duplicate entries in the result set.

10. Which among the following is an optional Keyword?
a) DISTINICTS
b) ALL
c) AS
d) Both AS and ALL

Answer: d
Clarification: “AS” and “ALL” are optional.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top