Limit data

LIMIT is just a way to tell MySQL not to return everything.

So even if a table has a lot of rows, you can say “give me only the first 10” or “give me only 5 rows starting from a certain point.” That is useful both for performance and for controlling output, especially when the table gets bigger.

The simplest form is LIMIT number. That means “return at most this many rows.”

Then there is the version with an offset. That means “skip some rows first, then return a certain number of rows.” So LIMIT 10 OFFSET 15 means: skip the first 15 rows, then return the next 10.

There is also the shorter comma version, like LIMIT 15, 10. It means the same thing, but the order feels a bit more confusing because it is offset first, then count.

So the main use of this lesson is very practical: combine SELECT with LIMIT when you only want part of the result set instead of everything.