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 trialLeon Ying
1,510 PointsCan someone please help on what's missing from this code?
Maybe I'm missing something really obvious...thanks!
SELECT genre, COUNT(genre) AS genre_count FROM books GROUP BY genre;
4 Answers
David Marec
9,578 PointsHi Leon,
perhaps i'm too late but the right code is
SELECT genre, count(*) AS genre_count FROM books GROUP BY genre;
You have to count with a star !
Raffael Dettling
32,999 PointsYou dont need the "," after genre
Leon Ying
1,510 PointsThanks Raffael. Taking out the , results in the following error.
SQL Error: near "(": syntax error
Raffael Dettling
32,999 Pointsok hm the thing is the "(" after count should be correct . Maybe you can find the syntax error on this side:
Leon Ying
1,510 PointsThat worked perfectly. Thanks David!