Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Sambath Phum
4,089 PointsDatabase: how to remove more than one actors?
In the exercise for removing data in - Remove actors with the first name "Yuri", "Walter" and "Victor".
My input is:
DELETE FROM actors WHERE name LIKE ("Yuri%" AND "Walter%" AND "Victor%);
Is the the correct format?
3 Answers

Steven Parker
215,954 PointsYou can't combine just terms with AND
.
And AND
is for requiring all conditions at once, OR
is for any one of the conditions.
But you can combine complete expressions:
... name LIKE "Yuri%" OR name LIKE "Walter%" OR name LIKE "Victor%";

Matthew Wilkes
4,810 PointsI used the below and this seemed to work for me:
DELETE FROM actors WHERE name IN ("Yuri", "Walter", "Victor")

Steven Parker
215,954 PointsSure, but you can't use the wildcard "%" when using the membership operator ("IN"). It only works with "LIKE".
The "IN" operator only works with exact matches.
But as you discovered, wildcards are not needed for this challenge.

Joseph Lander
Full Stack JavaScript Techdegree Graduate 27,763 PointsThat didn't work for me? Names starting with "Yuri" are still there. Doesn't this mean it is looking for an exact match? It won't be as there is a lastname.

Kate McPherson
2,149 PointsIn case anyone is looking for the same answer that I have been looking for regarding how to leave out the entries like "Yuriko" - you need to leave a space between the text and the % wildcard.
Instead of "Yuri%" it needs to be "Yuri %". You can do the same with Victor to leave out any Victorias.
Christian Higgins
15,758 PointsChristian Higgins
15,758 PointsWould this also delete the actresses named "Victoria"?
Steven Parker
215,954 PointsSteven Parker
215,954 PointsIt would! So perhaps a better solution would be to include a space between the name and the "%" symbol.