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!
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 trial
caio França Lima
365 Pointsquestion 2 database
Someone can tell me how can i pass this chalenge ?
i'm usying the query : 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?
And the question is :Challenge Task 2 of 2
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. Type in your command below.
Where am i doing wrong ? Appreciate
2 Answers

Steven Parker
224,848 Points It looks like you overlooked the part of the instructions that said, "Only retrieve the last_name column".
SELECT last_name FROM phone_book WHERE last_name IS NOT NULL;

Kieran Wallser
3,008 PointsSELECT * FROM phone_book WHERE last_name IS NOT NULL;
WHY DOESNT THIS WORK

Elias K. Salem
22,283 PointsSELECT last_name FROM phone_book WHERE last_name IS NOT NULL;
This syntax should work, because were pulling "only" last name contacts from the phone book, not all the contact info in the phone book.
caio França Lima
365 Pointscaio França Lima
365 Pointscan you tell me what is the correct form ?
caio França Lima
365 Pointscaio França Lima
365 Pointsthanks for your help, i read the sentence with paitience and fixed this chalenge. thanks.
select last_name from phone_book where last_name is not null