SQL - Advanced Query Patterns
You want to find customers who placed more than 3 orders and spent over $500 total. Which query pattern correctly achieves this?
SELECT customer_id, COUNT(*), SUM(amount) FROM orders GROUP BY customer_id HAVING COUNT(*) > 3 AND SUM(amount) > 500;
