Code Editor

Query Results

Run a query to see results.

Database Schema

Schema undefined.
Learn
Queries

Limit

We've been working with a fairly small table (230 rows), but most SQL tables contain hundreds of thousands of records. In those situations, it becomes important to cap the number of rows in the result.

For instance, imagine that we just want to see a few examples of records.

SELECT * FROM movies LIMIT 5;

LIMIT is a clause that lets you specify the maximum number of rows the result set will have. This saves space on our screen and makes our queries run faster.

Here, we specify that the result set can't have more than five rows.

LIMIT always goes at the very end.

Report a Bug
If you see a bug or any other issue with this page, please report it here.