This set of MySQL Multiple Choice Questions & Answers (MCQs) focuses on “The select Clauses – 2”.
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
View Answer
Explanation: “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
View Answer
Explanation: “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
View Answer
Explanation: 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
View Answer
Explanation: “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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: “AS” and “ALL” are optional.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check MySQL Books
- Check Information Technology Books
- Practice Programming MCQs
- Apply for Programming Internship