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
Shari Staten
11,540 PointsSQL Challenge Task 2
I'm not sue how many times can do this one. It looks right. Am I missing something? I keep getting an error that something is wrong and yes, I have closed out and reopened my browser jic the code I wrote is correct. Please help!
1 Answer
Shari Staten
11,540 PointsThanks for the reply!
The question: In the library database there's a books table. There are id, title, author, genre and first_published columns.
Write a query to count all the unique genres in the books table. Alias it as total_genres.
My original code: SELECT genre, COUNT (DISTINCT genre) AS total_genre FROM books;
The error message I kept getting: Bummer! Your query didn't perform the correct count.
After about an hour and a half of playing with different variations, I came up with: SELECT COUNT (DISTINCT genre) AS total_genre FROM books;
I just tried it again and I get the same error message. Somehow I passed the challenge but I can't seem to remember wht i did.
Robert Anthony
19,952 PointsRobert Anthony
19,952 PointsCan you show your code here so we can see what is not correct?