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

Stuart Guest-Smith
Stuart Guest-Smith
5,343 Points

Not sure what's wrong? - 'Your query needs to retrieve the earliest 'Science Fiction' book from the `books` table."

I believe the SQL statement is correct, however, I'm receiving the following: 'Bummer! Your query needs to retrieve the earliest 'Science Fiction' book from the books table.' I've tried a number of different versions with no luck. Your thoughts would be great.

Aaron Campbell
Aaron Campbell
16,267 Points

Could you please post your code?

Stuart Guest-Smith
Stuart Guest-Smith
5,343 Points

Thank you, all that responded. My apologies it's been a few crazy weeks. The question from the assessment is:

"In a library database there's a books table. There's a title, author, genre and first_published column. The library database is connected to a website displaying 10 books at a time, sorted by the title alphabetically. Write a query to bring back the second page of results. Please retrieve all columns of information."

My SQL is: SELECT * FROM books ORDER BY title ASC LIMIT 10 OFFSET 2;

The response back is: "Bummer! Your query needs to retrive the earliest 'Science Fiction' book from the books table."

I've tried a few different approaches, however, I'm sure I'm missing something very obvious! Thanks in advance.

3 Answers

Aaron Campbell
Aaron Campbell
16,267 Points

I'm a little confused by this. It wants the earliest Science Fiction book, but the question is asking for it to order by title. Makes no sense.

SELECT * FROM books ORDER BY title ASC LIMIT 10 OFFSET 10;

Your offset was.... well, off.

samtruss1986
samtruss1986
11,772 Points

Hi Stuart, Without posting the answer to the code challenge I could suggest a option.

Im guessing that from the CRUD acronym you'd like to read the data, so the SELECT keyword would be used for this.

You then have to enter the column name that you're after remembering to separate them with a comma, or if you'd like data from all columns then a " * " would be your solution.

Next you have to tell the query which table to get the data from. in this case the "books" table.

The next steps are the final piece to the challenge. Try looking for the ORDER BY keyword and the LIMIT keyword to help you select the item that you are looking for,

I hope this helps,

Good luck!

Stuart Guest-Smith
Stuart Guest-Smith
5,343 Points

Hi Aaron! That makes complete sense as it was looking for the multiplier. Thanka!