Database - Introduction to SQL - Discussion

Discussion :: Introduction to SQL - General Questions (Q.No.25)

25. 

Find the SQL statement below that is equal to the following: SELECT NAME FROM CUSTOMER WHERE STATE = 'VA';

[A]. SELECT NAME IN CUSTOMER WHERE STATE IN ('VA');
[B]. SELECT NAME IN CUSTOMER WHERE STATE = 'VA';
[C]. SELECT NAME IN CUSTOMER WHERE STATE = 'V';
[D]. SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');

Answer: Option D

Explanation:

No answer description available for this question.

Shiwam said: (Sep 19, 2011)  
Explain.

Mohini said: (Oct 5, 2011)  
Please explain.

Ganesh said: (Apr 8, 2012)  
The IN function helps reduce the need to use multiple OR conditions.

The syntax for the IN function is:

SELECT columns
FROM tables
WHERE column1 in (value1, value2, .... value_n);

This SQL statement will return the records where column1 is value1, value2..., or value_n. The IN function can be used in any valid SQL statement - select, insert, update, or delete.
Example #1:

The following is an SQL statement that uses the IN function:

SELECT *
FROM suppliers
WHERE supplier_name in ( 'IBM', 'Hewlett Packard', 'Microsoft');

This would return all rows where the supplier_name is either IBM, Hewlett Packard, or Microsoft. Because the * is used in the select, all fields from the suppliers table would appear in the result set.

Ranju said: (Jun 16, 2016)  
Please explain it in some other way.

Hrishi said: (Nov 26, 2016)  
Other 3 have a syntax error.

Vkhan said: (Jan 31, 2017)  
Thank you so much for explaining this.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.