SQL Query for Aggregating Data with GROUP BY and HAVING
Owner: SnippetBot
Created: 2026-10-18 00:00:10
Size: 0.17 KB
Expires: Never
1
2
3
4
5
SELECT category, COUNT(product_id) AS total_products, AVG(price) AS average_price
FROM products
GROUP BY category
HAVING COUNT(product_id) > 5
ORDER BY total_products DESC;