>_ QueryLocal All recipes
SQL recipe

How do I count rows per category with SQL GROUP BY?

SELECT category, COUNT(*) AS orders
FROM data
GROUP BY category
ORDER BY orders DESC;
Run this query in QueryLocal →

`COUNT(*)` inside a `GROUP BY category` query counts how many rows fall into each category, rather than counting the whole table at once. Ordering by that count descending surfaces the most frequent category first.

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).