Loading…
The LIMIT clause restricts the number of rows returned. This is essential when working with large tables!
SELECT * FROM table_name
LIMIT number;
-- Quick preview: just see 5 rows
SELECT * FROM products LIMIT 5;-- Top 3 most expensive products
SELECT * FROM products
ORDER BY price DESC
LIMIT 3;
-- 3 cheapest products
SELECT * FROM products
ORDER BY price
LIMIT 3;
The correct query order is:
SELECTFROMWHERE (optional)ORDER BY (optional)LIMIT (always last!)Select the 3 cheapest products (lowest price first).
Downloading SQL engine… (one-time)
This runs entirely in your browser and is cached for next time.