GROUP BY in SQL — a practical guide to SQL GROUP BY with clear examples you can reuse in real projects.
SQL Tutorial Series (38/100). Prefer one article? Read the complete SQL tutorial.
Short description
Selected non-aggregated columns must be grouped (or functionally dependent, per engine rules).
Group by
SELECT status, COUNT(*) AS total
FROM orders
GROUP BY status;