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 trialJEFFERSON DCRUZ
Courses Plus Student 7,772 PointsCould someone assist me with this question please?
Challenge Task 3 of 3
Note: We will be writing ONLY the SQL query for this challenge.
The Media
table also contains a category
column. Add another condition to the WHERE clause so that only the "Books" category is selected.
You may start with the following code from the last task:
SELECT title FROM Media
JOIN Media_People ON Media.media_id = Media_People.media_id
JOIN People ON Media_People.people_id = People.people_id
WHERE fullname LIKE '%Tolkien';
Type in your command below.
My code was
SELECT title FROM Media JOIN Media_People ON Media.media_id = Media_People.media_id JOIN People ON Media_People.people_id = People.people_id WHERE category LIKE 'Books'AND '%Tolkien';
I am getting an error
Did you select ONLY the 'title from the "Media" table?
Could some one assist please?
2 Answers
Javier Porras
11,382 PointsNeed to be sure you specify this part; AND category = 'Books' (see below)
SELECT title FROM Media JOIN Media_People ON Media.media_id = Media_People.media_id JOIN People ON Media_People.people_id = People.people_id WHERE fullname LIKE '%Tolkien' AND category = 'Books';
Simon Coates
28,694 Pointsis this what you're after? The where condition looks shonky. Unless the course is new with treehouse, someone will usually have tripped over the same hurdle before - so you can use the forum search or google (treehouse and some term particular to your current problem) to search the forums. Usually, you can find something.