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 trialZachary Wheeler
1,157 PointsReporting in SQL Challenge 2 Task 2
Here is the link to my challenge.
I have:
SELECT * FROM books ORDER BY last_name, first_name LIMIT 20 OFFSET 20;
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're doing well and you just have two tiny corrections to make here. First, you're selecting all columns from the books
table. But in this step, there is no books table. Check the instructions for the name of the table you're looking at.
Also, your offset is incorrect. It wants you to return the 3rd page. Each page contains 20 contacts. And you have an offset of 20 so it'll show the second page, not the third.
After making the proper adjustments in the table name and the offset number, your statement should pass. Good luck, but let me know if you're still stuck!
Zachary Wheeler
1,157 PointsZachary Wheeler
1,157 PointsOk, thanks for pointing that out. I must have forgotten to switch out the names from the previous challenge. As far as the offset goes, its asking for the third page. So the Limit would be 20 but the offset would have to in the first 10 pages. But when I put 10 it doesn't work. Am i missing something with that offset calculation?
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherZachary Wheeler I think you're missing what the offset does. Ok so we have a limit of 20. This means that 20 results will be shown per page. So the first page will contain results 1-20. The second page will contain results 21 - 40 and the third page will contain 41-60. If you set the offset to 10 it will start the results at 10. So the first page would contain the results 11 - 30. Giving us a total of 20 results with an offset of 10.
The offset you're looking for is 40. This will start our results at 41 and list 20 results. Hope this helps!
Zachary Wheeler
1,157 PointsZachary Wheeler
1,157 PointsOk that makes so much more sense now. Thanks so much! I was thinking the limit was the actual amount of pages for some reason. That clears that up. Thanks!