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

PHP

Please help me with this problem.

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

My code is as follows:

SELECT count(*) from books where genre="Science Fiction" as "scifi_book_count";

5 Answers

Simon Coates
Simon Coates
28,694 Points

my guess is

SELECT count(*) as "scifi_book_count" from books where genre="Science Fiction" ;

but if you include a URL, I can test.

It worked. Thank you very much!

I typed in

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

scific_book_count 6

But it says my query didn't perform the correct count.

Simon Coates
Simon Coates
28,694 Points

if you specify which challenge this is related to (a url?), then i can test it. Looks okay at a glance, apart from the spelling mistake ("scific_book_count" instead of "scifi_book_count").

Aananya Vyas
Aananya Vyas
20,157 Points

select count(id) AS scifi_book_count from books where genre= "Science Fiction";

try this!