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

Databases

Shouldn'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
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

I 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;

Thanks! This is what ended up working:

SELECT COUNT(DISTINCT genre) AS scifi_book_count FROM books;

Julien Steel
Julien Steel
10,790 Points

SELECT COUNT(genre) AS scifi_book_count FROM books WHERE genre = "Science Fiction";

Cindy Lea
PLUS
Cindy Lea
Courses Plus Student 6,497 Points

You need to post code or the challenge so we can see what youre talking about....

In the library database, how many books are with the genre of "Science Fiction"? Alias the result as scifi_book_count.