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

Databases

Chris Bertolino
Chris Bertolino
4,000 Points

What is the name of the library database for this question? Normally it's told that the database name is "x".

select count(books) as scifi_book_count from library_database where genre = "Science Fiction";

This is my code for this challenge task. Normally the name of the database is given but here it is not, and the error I get is "SQL Error: No such table: ... "

Thank you.

Can you link to the challenge?

2 Answers

Steven Parker
Steven Parker
231,248 Points

The table name is contained in the challenge question.

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

Notice how some of the words are in a different font? These are hints about the database structure. It looks like you guessed (correctly) that "genre" was a column name. Similarly, "books" is the table name.

SELECT COUNT(DISTINCT genre) AS total_genres FROM books ; PLEASE CHECK THIS.