Machine-translated by Google. Questions are authored in English.
Top

Discussion

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: D

Correct answer: SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');

IN tests membership of a list, and a list with one element is equivalent to an equality test, so STATE IN ('VA') means the same as STATE = 'VA'.

The other three options fail on syntax rather than on logic: they write IN CUSTOMER where the source table must follow FROM. That is the real test here - the clause naming the table is FROM, and IN is a predicate belonging inside WHERE.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.