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

Victoria Loisi
Victoria Loisi
7,070 Points

Why I need to retrieve the "earliest" book if the sorting order should be made alphabetically?

What I need to do 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.

So, I'm doing this:

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

But I keep getting this error: Bummer! Your query needs to retrive the earliest 'Science Fiction' book from the books table.

Why the earliest edition? What's wrong with my query? Thanks!

2 Answers

Hi Victoria,

You have to skip the first 10 results so your OFFSET should probably be 10.

Please link to the challenge if you're still having trouble with it.

Victoria Loisi
Victoria Loisi
7,070 Points

Thank you, you were right!