+ 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.

4th Jan 2018, 11:51 AM
Audun Ingebrigtsen
Audun Ingebrigtsen - avatar
3 Respuestas
+ 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 *
4th Jan 2018, 2:16 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
because "SELECT * FROM ..." select all the columns and "SELECT name, state FROM..." select just name and state for the answer.
4th Jan 2018, 12:29 PM
Jacinto Lima
Jacinto Lima - avatar
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..
4th Jan 2018, 12:08 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar