SQL - GROUP BY and HAVING
Given the table sales with columns region and amount, what will this query return?
SELECT region, SUM(amount) FROM sales GROUP BY region HAVING SUM(amount) > 1000;
Given the table sales with columns region and amount, what will this query return?
SELECT region, SUM(amount) FROM sales GROUP BY region HAVING SUM(amount) > 1000;
region and calculates total amount per region.HAVING clause keeps only regions where the sum is greater than 1000.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions