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 trialDaniel Murrieta
2,143 PointsSQL Query Search for last name
It says I'm missing a IS Keyword but if I add IS to the code then it just says something is wrong with the SQL statement. Can anyone tell me what I am missing here? Am I even approaching it the correct way?
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.
Bummer! You're missing an IS keyword!
SELECT last_name FROM phone_book WHERE last_name LIKE "%";
last_name Holligan Kozup Chalkley McFarland Luna
Steven Parker
231,261 PointsPreferably both
1 Answer
Kieran Black
9,139 PointsHi Daniel,
This one is a bit misleading with the mention of autocompletion, instead the challenge is simply wanting you to return last_name from the phone_book where the last_name is not empty.
SELECT last_name FROM phone_book WHERE last_name IS NOT NULL;
Hope this helps
Daniel Murrieta
2,143 PointsThanks Kieran. Does help.
Thomas Nilsen
14,957 PointsThomas Nilsen
14,957 Pointscan show your code or link to the challenge?