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 trialJohn Faught
3,484 PointsReading Data from Databases with SQL: Limit and Offset
I am having some trouble understanding limit and offset in the database foundations. I understand it in the examples they give in the video, but in the code challenge it tells me to "Get the 101st to 200th actor from the actors table." I am having trouble processing how to make this work. Could anyone explain and clear this up for me? Thanks!
Dennis Howell
1,072 PointsSorry "FROM"
3 Answers
Elliott Frazier
Courses Plus Student 9,647 Pointsif you could provide the code you've done thus far I would be glad to give you some pointers
Christopher Peters
1,927 PointsOne way may be where id > 100 limit 99
Dennis Howell
1,072 Points"id" is incorrect because there's no column for it. I tried "SELECT * FROM actors WHERE name > 100 LIMIT 99;" This did not work either. Please someone help with this challenge.
Christopher Peters
1,927 PointsHi Dennis Howell, I see that my original comment may have steered you wrong. This code challenge would like you to use the LIMIT and OFFSET options. The LIMIT option determines how many records to pull and the OFFSET option selects the starting number plus one. Therefore, if you want the first 100 records starting at the 101st record you'd use:
SELECT * FROM actors WHERE LIMIT 100 OFFSET 100
Hope that helps!
Dennis Howell
1,072 PointsThanks Chris. That clears up a lot. Now I can move on. And also thanks for the swift reply, your the man!
Dennis Howell
1,072 PointsDennis Howell
1,072 PointsI'm having trouble with this challenge also. This is what I tried..... "SELECT * FORM actors LIMIT 99, 200;" Can't seem to figure this one out.