easy5 pts · first answer countssqlaggregation
Filtering groups with HAVING
orders has rows (customer_id, amount): (1,10), (1,20), (2,5), (3,40), (3,60), (3,1). What does this query return?
SELECT customer_id, SUM(amount) FROM orders GROUP BY customer_id HAVING COUNT(*) > 1 ORDER BY customer_id;
Discussion 0
Join free to post in the discussion.
Related questions
- Purpose of a primary keyData Engineer
- Row count of a LEFT JOINData Engineer
- Filtering with = NULLData Engineer
- COUNT(*) vs COUNT(column)Data Engineer
- Adding a number to NULLData Engineer
- Orders pointing to missing customersData Engineer
- Upserting into a target tableData Engineer
- Keeping the latest row per keyData Engineer