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
daniwao
13,125 PointsSELECT * FROM movies WHERE actors LIKE '%Tom'; //Not sure where the error is
The question is asking me to query and select a column named actors and then to find the row with the name 'Tom'.
Here is my code.
SELECT * FROM movies WHERE actors LIKE '%Tom';
please help!
daniwao
13,125 PointsThe error that I'm getting is that it says SQL ERROR; no such column: actors
But the issue is that this is what the question is asking me. Copy and pasted below.
Challenge Task 4 of 4 Select all actors whose name starts with "Tom".
Jacques Vincilione
17,292 Pointsmaybe it's "actor" not "actors", which would honestly make more sense.
Also, if the name starts with "Tom" it should be
SELECT * FROM movies WHERE actor LIKE 'Tom%';
daniwao
13,125 PointsThanks for the suggestion Jacques Vincilione , but it says no column named 'actor' as well.
Jacques Vincilione
17,292 PointsCan you post the link to the exact question? Just copy/paste the url.
daniwao
13,125 PointsIt's challenge 4 of 4. I'm sure I'm making a simple mistake but I can't see where. Thanks for being so helpful!
Jacques Vincilione
17,292 PointsNo problem. The issue is that you are querying the wrong table.
SELECT * FROM actors WHERE name LIKE 'Tom%'
daniwao
13,125 PointsYes!! Thank you! It was killing me!
Jacques Vincilione
17,292 PointsI added it as an answer if you don't mind marking it correct.
daniwao
13,125 PointsYea I was actually just looking to do that. LOL!
4 Answers
Jacques Vincilione
17,292 PointsThe issue is that you are querying the wrong table.
SELECT * FROM actors WHERE name LIKE 'Tom%'
J Scott Erickson
11,883 PointsIf i recall correctly you are querying the incorrect table
SELECT * FROM actors WHERE name LIKE "%TOM%";
J Scott Erickson
11,883 Pointsor first_name... I can't recall so far as to remember the exact column names. But I do remember that that tutorial involves a table named 'actors'
Michael Collins
433 PointsNot familiar with your project, but .... Your query would match "xTom" but not "Tomx" or "Tom x" The percent sign (%) is a wild card. Assuming the actors column contains first and last names concatenated into a single field, you just need to change the position of your wild card, like so ...
SELECT * FROM movies WHERE actors LIKE 'Tom%';
daniwao
13,125 PointsThe error that I'm getting is that it says SQL ERROR; no such column: actors
But the issue is that this is what the question is asking me. Copy and pasted below.
Challenge Task 4 of 4 Select all actors whose name starts with "Tom".
Cesar De La Vega
13,900 PointsThis worked for me:
SELECT * FROM actors WHERE name LIKE "%Cruise";
Jacques Vincilione
17,292 PointsJacques Vincilione
17,292 PointsTry:
SELECT * FROM movies WHERE actors LIKE '%Tom%';