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 trialMax Reinsch
5,740 PointsMySQL question
"Get the 101st to 200th actor from the actors table. (No need to use any ordering)."
I Keep getting the wrong answer.
"Select * from actors limit 200 offset 100;" - is along the lines of the answers I've been giving. =/
Any ideas?
Thanks in advance, Max.
3 Answers
Phillip Gibson
13,805 PointsThe limit
keyword will tell the database how many results to return, not what maximum record to pull. Try this
Select * from actors limit 99 offset 100;
Jeremy Germenis
29,854 Pointsyour statement is getting 200 entries starting at the 101st
Max Reinsch
5,740 PointsCheers mate.
Max Reinsch
5,740 PointsCheers for the help guys.
Turns the answer was "select * from actors limit 100 offset 100;"
Phillip Gibson
13,805 PointsSo close. That's what I get for cavalier coding. Glad to point you in the right direction though. :)
Max Reinsch
5,740 PointsCheers Phil. Both replies helped me identify the error; I'm a bit slow. =P
Ahmed Shaaban
1,577 PointsAhmed Shaaban
1,577 PointsCould you please explain how does this work? I know it's retrieve 100 rows but when you offset it by 100, what does that do again? I was a bit confused about the offset
Thanks Ahmed