Aggregate rows and then filter groups.
Section: Querying, Joins, and Aggregation
Group and filter aggregates
sql
sql
SELECT customer_id, count(*) AS order_count
FROM orders
GROUP BY customer_id
HAVING count(*) >= 5;Explanation
See summary for usage details.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Querying, Joins, and Aggregation