Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBorislav Parov
626 PointsChallenge Task 1. Need help with the SQL query
I've written SELECT * FROM products;
it tells me to write SELECT? Please help. Thanks.
6 Answers
Brandon Hartman
8,032 PointsCan you link the question to the task so we can take a look at it? It may be a error the challenge.
Nicholas Ivezic
2,791 PointsI am also receiving the same error. I would appreciate your help, Brandon. Thanks!
We're still using the phone_book, with the columns id, first_name, last_name and phone. Imagine we're implementing the autocomplete feature for a search facility on the phone where a user can start typing a last name and suggestions will appear. Write a query to retrieve all values from the last name column where the last name value is present. Only retrieve the last_name column
SELECT * FROM phone_book WHERE last_name IS NOT NULL;
Bummer! Did you test the `last_name` column from the `phone_book` table to see if it's not NULL?
caio França Lima
365 Pointscan you tell me how to fix this ? i opened a ticket about this same question and i'm waiting to pass this chalenge.
tryed with SELECT * FROM phone_book WHERE last_name IS NOT NULL
but returns me a message of error like that : Bummer! Did you test the last_name
column from the
phone_book
table to see if it's not NULL?
Where am i doing wrong ?
Nicholas Ivezic
2,791 PointsI figured it out, it has been worded poorly. From SQL Basics: Filtering Out or Finding Missing Information. (2 Objectives)
We're still using the phone_book, with the columns id, first_name, last_name and phone. Imagine we're implementing the autocomplete feature for a search facility on the phone where a user can start typing a last name and suggestions will appear. Write a query to retrieve all values from the last name column where the last name value is present. Only retrieve the last_name column.
They are asking for information exclusively from the last name column, not information from all columns. With that, SELECT last_name, rather than SELECT *.
ANSWER: SELECT last_name FROM phone_book WHERE last_name IS NOT NULL;
Cheers
Nicholas Ivezic
2,791 PointsI figured it out, it has been worded poorly. From SQL Basics: Filtering Out or Finding Missing Information. (2 Objectives)
We're still using the phone_book, with the columns id, first_name, last_name and phone. Imagine we're implementing the autocomplete feature for a search facility on the phone where a user can start typing a last name and suggestions will appear. Write a query to retrieve all values from the last name column where the last name value is present. Only retrieve the last_name column.
They are asking for information exclusively from the last name column, not information from all columns. With that, SELECT last_name, rather than SELECT *.
ANSWER: SELECT last_name FROM phone_book WHERE last_name IS NOT NULL;
Cheers
Ladislav Vysmek
999 PointsSELECT last_name FROM phone_book WHERE last_name IS NOT NULL;
Andrew Chalkley
Treehouse Guest TeacherHi all,
The last sentence says to "Only retrieve the last_name
column."
You're not required to bring back all columns with *
caio França Lima
365 PointsThank you Andrew but i got the challenge first kk thx your attention
chase singhofen
3,811 Pointsthx didnt even think to use the last_name twice. and omit the *
Jason Cheung
2,327 PointsDear all, I've the same problem too, please advise.
caio França Lima
365 PointsI have the same problem here, the query are correct ,isn't ? i'm usying the query : SELECT * FROM phone_book WHERE last_name IS NOT NULL from the question, but are returning this error message, what can we do to fix this question ?
Graham Patrick
8,294 PointsThis should be spot on here
SELECT last_name FROM phone_book WHERE last_name IS NOT NULL;
Nader Habib
1,106 PointsSELECT * FROM phone_book WHERE last_name IS NOT NULL;
Where is the error
Did you test the phone
column from the phone_book
table to see if it's NULL?
Borislav Parov
626 PointsBorislav Parov
626 PointsThis is the task: We're still using the phone_book, with the columns id, first_name, last_name and phone. Imagine we're implementing the autocomplete feature for a search facility on the phone where a user can start typing a last name and suggestions will appear. Write a query to retrieve all values from the last name column where the last name value is present. Only retrieve the last_name column.
This's my answer: SELECT * FROM phone_book WHERE last_name IS NOT NULL;
This's the result from my answer above: Bummer! Did you test the
last_name
column from thephone_book
table to see if it's not NULL?