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 Database Foundations Reading Data from Databases with SQL Limiting the Result Set

Hi there, Can anyone help me with this question: Get the 101st to 200th actor from the actors table.

I don't know how to write the query for this question: Get the 101st to 200th actor from the actors table. (No need to use any ordering).

Thanks in advance

3 Answers

Joseph Anderson
Joseph Anderson
10,617 Points

You can also forgo using the OFFSET keyword and run the following:

SELECT * FROM actors LIMIT 100, 100;

Just remember that the first number is the OFFSET and that the count starts at 0.

Sobin Sebastian
Sobin Sebastian
5,348 Points

this is also correct answer: SELECT * FROM actors LIMIT 100, 100;

Ryan Ruscett
Ryan Ruscett
23,309 Points

There are a couple ways to get this, but for me it's all about the between operator.

http://www.w3schools.com/sql/sql_between.asp

I would give you the answer but it would just be repeating the link. Let me know if that solves your issue.

Thanks!

Thank you so much Ryan, but that was not the required solution:$

It required to use the keyword LIMIT

Finally, I re-watched again the video, and the solution (for everyone else who doesn't know this answer) is:

SELECT * FROM actors LIMIT 100 OFFSET 100;

Thanks for your time