Blog · Guide

SQL LIMIT Explained: Take Only the Top N Rows

LIMIT caps how many rows you get back. Pair it with ORDER BY for “top 3 products” style questions.

customers first_name last_name city result first_name · city
SELECT chooses which columns appear in the result.

Top-N needs a sort first

SELECT name, price
FROM products
ORDER BY price DESC
LIMIT 3;

Without ORDER BY, LIMIT just returns some N rows — not “the top” anything. Sort, then cut.

Try it yourself

The fastest way to lock this in is a short drill on the same Northstar Market tables.

Practice LIMIT

Related guides