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!

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


Christopher Westman
Christopher Westman
9,680 Points

In the library database there's a books table. There are id, title, author, genre and first_published columns.

I'm trying to figure out what is going on with my code. When I run the code, the result is exactly what the question is asking for. It gives me the name of each genre without duplicating it and it gives me the number of books in each. Even though I'm correct, I still can't get credit if I just skip to the next lesson.

2 Answers

Chris Seals
Chris Seals
4,506 Points

I noticed that as I was going through the SQL course (just finished today) I would run into this issue only when I wasn't selecting the information in the order that it was asked for. This was usually me unconsciously thinking that if I was going to present that data, I felt it would be better presented in a different order. Be sure that you are populating the result table exactly as it is asked for. Hope this helps XD

SELECT COUNT( DISTINCT genre) AS "total_genres" FROM books;