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

Garrett Levine
Garrett Levine
20,305 Points

Problem in PHP DB Query Challenge

I am having trouble undrestanding what this question is asking me to do...

'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.'

I am writing the following query...

SELECT title, author, genre, first_published
FROM books
ORDER BY books.title
LIMIT 10
OFFSET 10

it is throwing this error...

' Your query needs to retrive the earliest 'Science Fiction' book from the books table'

1 Answer

Simon Coates
Simon Coates
28,694 Points

maybe

select * from books order by title limit 10 offset 10;

if you look at https://teamtreehouse.com/community/limit-and-offset-having-trouble-with-these-challenges people have been getting back a mystery science fiction message back on one or two sql challenges for at least a matter of months. . If you have sufficient time and adequte fury, you might care to email treehouse.