Complete the code to group the sales by both city and product.
SELECT city, product, SUM(sales) FROM sales_data GROUP BY [1];The GROUP BY clause groups rows that have the same values in both city and product columns, so the sum of sales is calculated for each unique city-product pair.
Complete the code to select city and product, and count the number of sales entries for each group.
SELECT city, product, COUNT(*) FROM sales_data GROUP BY [1];Grouping by both city and product allows counting how many sales entries exist for each unique combination.
Fix the error in the GROUP BY clause to correctly group by city and product.
SELECT city, product, AVG(price) FROM sales_data GROUP BY [1];Columns in GROUP BY must be separated by commas. Writing them without commas causes a syntax error.
Fill both blanks to group sales by city and product and order the results by city ascending.
SELECT city, product, SUM(sales) FROM sales_data GROUP BY [1] ORDER BY [2] ASC;
The query groups by both city and product and orders the results by city in ascending order.
Fill all three blanks to select city and product, count sales entries, and filter groups having more than 5 entries.
SELECT [1], [2], COUNT(*) FROM sales_data GROUP BY [3] HAVING COUNT(*) > 5;
The query selects city and product, groups by both columns, and filters groups with more than 5 sales entries using HAVING.