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 trialIsaac Lau
3,767 Pointsdon't under question database count/distinct
i want to know what's actually it want me to do?
i though it may want how many total genres that they have (because only require as total_genres)
which i try to complete with this query select count(distinct(genre)) as totel_genres from books
endup i got total_genres = 6.
But still fail in this challenge. So i think i'm very stupid, may i know what's the correct answer? on anything that i missing?
Thank You
Isaac Lau
3,767 PointsThx Steven.
https://teamtreehouse.com/library/reporting-with-sql/aggregate-and-numeric-functions/counting-groups
the first challenge completed. but second one have some problem.
2 Answers
Steven Parker
231,248 Points"DISTINCT
" is not a function.
You just place it in front of the term it applies to, such as in: "COUNT(DISTINCT genre)
".
Also, you wrote "totel_genres" with an extra "e" instead of "total_genres" (with an "a").
Isaac Lau
3,767 PointsThank You, but i also surprise that "COUNT(DISTINCT (genre))" also work and have a same outcome.
Steven Parker
231,248 PointsYes, because parentheses can also be used to group terms together, but they don't do anything when used around a single term. But it's confusing because it looks like you're invoking a function.
Steven Parker
231,248 PointsSteven Parker
231,248 PointsTo facilitate an accurate answer, please provide a link the course page you are working with.