Complete the code to select the total sales for each product.
SELECT product_id, SUM(sales) FROM sales_data GROUP BY [1];Grouping by product_id allows us to calculate the total sales per product.
Complete the code to find the average score for each student.
SELECT student_name, AVG(score) FROM exam_results GROUP BY [1];Grouping by student_name lets us calculate the average score per student.
Fix the error in the query to get the count of orders per customer.
SELECT customer_id, COUNT(order_id) FROM orders [1] customer_id;The GROUP BY clause groups rows by customer_id so COUNT counts orders per customer.
Fill both blanks to get the total sales and average price per category.
SELECT category, [1](sales), [2](price) FROM products GROUP BY category;
Use SUM to add sales and AVG to find average price per category.
Fill all three blanks to get the number of employees, average salary, and maximum age per department.
SELECT department, [1](employee_id), [2](salary), [3](age) FROM employees GROUP BY department;
Use COUNT to count employees, AVG for average salary, and MAX for maximum age per department.
