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

General Discussion

Code Challenge: Querying Tables 4/4

Hi I need a little help on the code challenge:querying tables i am on part 4/4 it asks you to "Select all actors whose name starts with "Tom"." please find the code below the i inputted:

SELECT * FROM movies WHERE actors LIKE "%Tom%";

Thanks chris :)

8 Answers


Rmove the % (percent symbol) that's before Tom

the percent sign is a wildcard... what you wrote looks for "Tom" somewhere in the middle. What you want "Start's with". Additionally, I think from what the question states, you should be looking in the "Actors" table, not "Movies"

try this

SELECT * FROM actors WHERE name LIKE "Tom%";

nope gordon that didnt work its throwing up an error "SQL Error: no such column: actors "

I just edited my reply... You are "Selecting" from the wrong table... sorry, I didn't catch it when I first replied... look above, for my changees.

I was editing my reply, while you were trying the original :)

Gordon Jiroux nailed it. If you include a wildcard before Tom then you are allowing the result set not to start with Tom. Since the question states that it must start with Tom, you must be able to realize that it can end with anything. Also known as, a wildcard (%).

cheers guys :) i love this forum, next stop for us TO TAKE OVER THE WORLD lol :)

"Pinky and the Brain" Style :) "What are we going to do Brain?"... "Same thing we do every day Pinky... Try and take over the world"

No problem chris lightfoot ... Always glad to help

i didnt think anyone would pick up on that, used to love pinky and the brain as a kid lol :) thanks again gordon. just spotted your score as well 6,207. mines only 3,615 :( got a lot of things to learn to catch up with you.

You'll get there Chris.. Just keep on truckin'