Complete the code to filter groups having more than 3 orders.
SELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id HAVING COUNT(*) [1] 3;
The HAVING clause filters groups where the count of orders is greater than 3.
Complete the code to find products with total sales equal to or more than 100.
SELECT product_id, SUM(quantity) FROM sales GROUP BY product_id HAVING SUM(quantity) [1] 100;
The HAVING clause filters products where total quantity sold is at least 100.
Fix the error in the HAVING clause to filter groups with average price less than 50.
SELECT category, AVG(price) FROM products GROUP BY category HAVING AVG(price) [1] 50;
The HAVING clause should use < to select groups with average price less than 50.
Fill both blanks to select customers with more than 5 orders and total amount over 1000.
SELECT customer_id, COUNT(*), SUM(amount) FROM orders GROUP BY customer_id HAVING COUNT(*) [1] 5 AND SUM(amount) [2] 1000;
Both conditions use > to filter customers with more than 5 orders and total amount over 1000.
Fill all three blanks to select products with average rating above 4, total reviews at least 50, and total sales over 200.
SELECT product_id, AVG(rating), COUNT(review_id), SUM(sales) FROM product_reviews GROUP BY product_id HAVING AVG(rating) [1] 4 AND COUNT(review_id) [2] 50 AND SUM(sales) [3] 200;
The HAVING clause filters products with average rating > 4, reviews ≥ 50, and sales ≥ 200.