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 trialEdward Li
373 PointsBummer! Ten books were expected. 4 were returned in the results.
2 bummers I got as below, when I got 10 returns, the bummer was retrieving 'Science Fiction'. When I added genre = 'Science Fiction', I got 10 books were expected. The inquiry was order by title and limit 10 offset 2. Thanks
select * from books order by title limit 10 offset 2;
id title author genre first_published
20 Animal Farm George Orwell 1945
13 Armada Ernest Cline Science Fiction 2015
19 Contact Carl Sagan Science Fiction 1985
17 Dune Frank Herbert Science Fiction 1965
15 Emma Jane Austen Classic 1815
10 Frankenstein Mary Shelley Horror 1818
2 Harry Potter and the Chamber of Secrets J.K. Rowling Fantasy 1998
7 Harry Potter and the Deathly Hallows J.K. Rowling Fantasy 2007
4 Harry Potter and the Goblet of Fire J.K. Rowling Fantasy 2000
6 Harry Potter and the Half-Blood Prince J.K. Rowling Fantasy 2005
Bummer! Your query needs to retrive the earliest 'Science Fiction' book from the books
table.
select * from books where genre = 'Science Fiction' order by title limit 10 offset 2;
id title author genre first_published 17 Dune Frank Herbert Science Fiction 1965 12 Ready Player One Ernest Cline Science Fiction 2011 18 The Circle Dave Eggers Science Fiction 2013 11 The Martian Andy Weir Science Fiction 2014 Bummer! Ten books were expected. 4 were returned in the results.
jcorum
71,830 PointsIt would be nice if you could give a link to the challenge you are working on, when you ask a question, so we can check the directions and also test our answer. Otherwise we waste time going back and forth.
This SQL will retrieve all fields for 10 records from the books table starting with the 3rd record, i.e., it skips the 1st two records:
select * from books order by title limit 10 offset 2;
2 Answers
Steven Parker
231,261 PointsFor the first task, the challenge asks you to return the second page of results. Since there's 10 on a page, you'd need OFFSET 10
instead of OFFSET 2
.
select * from books order by title limit 10 offset 10;
Some of the feedback messages you were getting seem misleading. You might want to report this as a bug to Treehouse Support.
Andrew Winkler
37,739 PointsSteven comes through with the crazy good memory! +1 Steven! You go Steven! :D
Andrew Winkler
37,739 PointsAndrew Winkler
37,739 PointsYou need to quote the question in order for forum partakers to help you.
What you've posted is similar to me posting on a math help forum
"guys, I got 42. help!"
and the forum partakers are like
"um, what's the context bruh?"