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 trialEthan Martin
Courses Plus Student 1,883 PointsRetrieving Data - SELECT, LIMIT, OFFSET
SELECT * FROM passport_holders WHERE name = "Lauren" LIMIT 0, 50;
Can someone tell me what this will do? The answer key is saying it will bring the first 50 rows with these specifications.
However, I interpreted this differently. I thought it would return "nothing" staring at the 51st entry.
isn't the second value the offset?
What does it mean to LIMIT by 0?
2 Answers
KRIS NIKOLAISEN
54,972 PointsFrom here
The Limit clause accepts one or two parameters, whenever two parameters are specified, the first is the offset and the second denotes the count whereas whenever only one parameter is specified, it denotes the number of rows to be returned from the beginning of the result set.
So with 2 parameters you'll retrieve 50 records starting at 0 (the first 50)
With one parameter (LIMIT 0) you'll retrieve 0 records
Ethan Martin
Courses Plus Student 1,883 PointsI see! Thank you!