How do I count rows per country with SQL GROUP BY?
SELECT country, COUNT(*) AS orders
FROM data
GROUP BY country
ORDER BY orders DESC;
Run this query in QueryLocal →
`COUNT(*)` inside a `GROUP BY country` query counts how many rows fall into each country, rather than counting the whole table at once. Ordering by that count descending surfaces the most frequent country 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).