+ 1
SQL Fundamentals - IN, NOT IN Statements
This is regarding the question: "Select customers from NY, CA, or NC, using the IN statement." Where the correct answer is: "SELECT name, state FROM customers WHERE state IN ('CA', 'NY', 'NC') ;" Can someone please explain me why it is not; "SELECT * FROM customers WHERE City IN ('CA', 'NY', 'NC')" instead. Where did the "name, state" come in and why id "*" gone ? If it is correct it should be explained what it does in the info page fore the question.
3 Antworten
+ 22
* here refers to all columns
but if u want to select only specific columns then u can mention those column name separated by comma in place of *
+ 2
because "SELECT * FROM ..." select all the columns and "SELECT name, state FROM..." select just name and state for the answer.
0
SELECT name, state _________ customers ______ state _________
I think this is the question..right?
here, it says to select name and city from the customers table where states are either CA, OR NY OR NC.
Now considering your point of view..
well * could also be used.. but that part is not editable in the question and question just asked to select name and state and CITY is not the option provided it is state given.. that is already printed..