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 trial

Development Tools

MySQL 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

The 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;
Ahmed Shaaban
Ahmed Shaaban
1,577 Points

Could 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

Jeremy Germenis
Jeremy Germenis
29,854 Points

your statement is getting 200 entries starting at the 101st

Cheers mate.

Cheers for the help guys.

Turns the answer was "select * from actors limit 100 offset 100;"

So close. That's what I get for cavalier coding. Glad to point you in the right direction though. :)

Cheers Phil. Both replies helped me identify the error; I'm a bit slow. =P