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 trialAmy Hsieh
6,023 PointsQ: The page can display 20 entries, I am asked to display the 3rd page of results.
This is my ANSWER:
SELECT * FROM phone_book ORDER BY last_name ASC, first_name ASC LIMIT 60 OFFSET 40
The system replied this query will result in 60 entries. I found the system message is misleading.
1 Answer
Steven Parker
231,269 PointsThe "LIMIT" value is how many to show, not the number of the last one. So if you "LIMIT 60", you'll get 60 results, no matter what the offset is (as long is it's not within 60 of the end).
Abhijeet Pednekar
Courses Plus Student 1,294 PointsAbhijeet Pednekar
Courses Plus Student 1,294 PointsSELECT * FROM phone_book ORDER BY last_name ASC,first_name ASC LIMIT 20 OFFSET 40;
Because question aksed is 3rd page output 1st page:1-20 2nd page:21-40 3rd page:41-60
So limit is 20 and the skipped rows are 40