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

Get the 101st to 200th actor from the actors table. (No need to use any ordering).

Hi, Can anyone help with question?

here is the code which i think is correct but not seem to be working:

SELECT * FROM actors LIMIT 100, 200;
Rich Donnellan
Rich Donnellan
Treehouse Moderator 27,696 Points

Fixed your formatting. From the Markdown Cheatsheet:

Code Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

        ```html
        <p>This is code!</p>
        ```
Bryan Guillen
Bryan Guillen
1,051 Points

hi,

I am getting error for this question too, and this thread didn't clarify much for me...

can someone help..

here's my sql..

SELECT * FROM actors LIMIT 100 OFFSET: 1 ;

Why is not that working?

2 Answers

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,696 Points

Cedric,

I think you're misunderstanding the value(s) in the "short-hand" LIMIT statement. Think of it like this:

SELECT * FROM table_name LIMIT 10 OFFSET 59; // LIMIT (give me 10 rows of results), OFFSET (starts counting at 60)
SELECT * FROM table_name LIMIT 59, 10; // OFFSET, LIMIT

Remember that we start counting rows at zero!

Hope this helps!

SELECT * FROM actors LIMIT 100 OFFSET 100;