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 trialSamuel Lindy
7,650 PointsShouldn't there be a table name for this question?
Don't you need a table name for the FROM portion of the query:
In the library database, how many books are with the genre of "Science Fiction"? Alias the result as scifi_book_count.
4 Answers
Jonathan Grieve
Treehouse Moderator 91,253 PointsI think in this question, books poses as your table name, so you want
books as the table name genre as the column your want to return with scifibook_count as the alias.
SELECT COUNT(genre) AS scifi_book_count FROM books;
Samuel Lindy
7,650 PointsThanks! This is what ended up working:
SELECT COUNT(DISTINCT genre) AS scifi_book_count FROM books;
Julien Steel
10,790 PointsSELECT COUNT(genre) AS scifi_book_count FROM books WHERE genre = "Science Fiction";
Cindy Lea
Courses Plus Student 6,497 PointsYou need to post code or the challenge so we can see what youre talking about....
Samuel Lindy
7,650 PointsIn the library database, how many books are with the genre of "Science Fiction"? Alias the result as scifi_book_count.