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 trial

Databases

caio França Lima
caio França Lima
365 Points

question 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
Steven Parker
229,582 Points

:point_right: 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;
caio França Lima
caio França Lima
365 Points

can you tell me what is the correct form ?

caio França Lima
caio França Lima
365 Points

thanks 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

SELECT * FROM phone_book WHERE last_name IS NOT NULL;

WHY DOESNT THIS WORK

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