MySQL Questions and Answers – The Where Clauses

This set of MySQL Multiple Choice Questions & Answers (MCQs) focuses on “The WHERE Clause”.

1. What is the meaning of the “WHERE” clause in Mysql?
a) Filtering out unwanted rows from result set
b) Filtering out unwanted columns from result set
c) Filtering out unwanted rows and columns from result set
d) None of the mentioned
View Answer

Answer: a
Explanation: None.

2. What will be the output of the following MySQL command?

SELECT *
FROM employee
WHERE title=’HEAD TELLER’;

a) All columns and rows belong to table employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title”
c) All columns don’t belong to table employee
d) None of the mentioned
View Answer

Answer: b
Explanation: “WHERE” clause is used to filter out unwanted rows therefore in above query only those rows will be selected which contain title as ‘HEAD TELLER’.
advertisement
advertisement

3. What will be the output of the following MySQL command?

Note: Join free Sanfoundry classes at Telegram or Youtube
SELECT *
FROM employee
WHERE (title=’HEAD TELLER’) AND (start_date=2013-01-24);

a) All columns and rows belong to table employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” and 2013-01-24 as a “start_date”
c) All rows belong to table employee
d) None of the mentioned
View Answer

Answer: b
Explanation: “WHERE” clause is used to filter out unwanted rows therefore in above query only those rows will be selected which contain title as ‘HEAD TELLER’ and start_date 2013-01-24.
advertisement

4. What will be the output of the following MySQL command?

SELECT *
FROM employee
WHERE (title=’HEAD TELLER’) OR (start_date=2013-01-24);

a) All columns and rows belong to table employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” or 2013-01-24 as a “start_date”
c) All rows belong to table employee
d) None of the mentioned
View Answer

Answer: b
Explanation: “WHERE” clause is used to filter out unwanted rows therefore in above query only those rows will be selected which contain title as ‘HEAD TELLER’ or start_date 2013-01-24.
advertisement

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

SELECT *
FROM employee
WHERE (title=’HEAD TELLER’) AND (start_date>2013-01-24);

a) All columns and rows belong to table employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” and start_date are greater than 2013-01-24
c) All rows belong to table employee
d) None of the mentioned
View Answer

Answer: b
Explanation: “WHERE” clause is used to filter out unwanted rows therefore in above query only those rows will be selected which contain title as ‘HEAD TELLER’ and start_date is greater than 2013-01-24.

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

SELECT *
FROM employee
WHERE (title=’HEAD TELLER’) OR (start_date>2013-01-24);

a) All columns and rows belong to table employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” OR start_date are greater than 2013-01-24
c) All rows belong to table employee
d) None of the mentioned
View Answer

Answer: b
Explanation: “WHERE” clause is used to filter out unwanted rows therefore in above query only those rows will be selected which contain title as ‘HEAD TELLER’ OR start_date is greater than 2013-01-24.

7. What will be the output of the following MySQL command?

SELECT emp_id, fname, lname
FROM employee
WHERE title=’HEAD TELLER’;

a) All columns
b) Only those columns which are mention with “SELECT” clause
c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a “title”
d) None of the mentioned
View Answer

Answer: c
Explanation: “WHERE” clause is used to filter out unwanted rows and “SELECT” clause is used to select columns from table.

8. What will be the output of the following MySQL command?

SELECT emp_id, fname, lname
FROM employee
WHERE title=’HEAD TELLER’ AND start_date=2008-11-24;

a) All columns
b) Only those columns which are mention with “SELECT” clause
c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a “title” and start_date as 2008-11-24
d) None of the mentioned
View Answer

Answer: c
Explanation: “WHERE” clause is used to filter out unwanted rows and “SELECT” clause is used to select columns from table.

9. What will be the output of the following MySQL command?

SELECT emp_id, fname, lname
FROM employee
WHERE title=’HEAD TELLER’ AND start_date>2008-11-23;

a) All columns
b) Only those columns which are mention with “SELECT” clause
c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a “title” and start_date>2008-11-23
d) None of the mentioned
View Answer

Answer: c
Explanation: None.

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.

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.