How do I get the top 3 rows by value with SQL LIMIT 3?
SELECT customer, category, quantity * unit_price AS line_total
FROM data
ORDER BY line_total DESC
LIMIT 3;
Run this query in QueryLocal →
The top-N pattern stays identical regardless of N: sort with `ORDER BY line_total DESC`, then cut the result at `LIMIT 3`. Only the number after `LIMIT` changes depending on how many rows you actually need back.
A table named data with columns: order_id (integer), customer (text), country (text), category (text), quantity (integer), unit_price (real), order_date (text, YYYY-MM-DD).