Complete the code to count the number of orders in the orders table.
SELECT [1](order_id) FROM orders;The COUNT function counts the number of rows or non-null values in a column. Here, it counts all order IDs.
Complete the code to find the average price from the products table.
SELECT [1](price) FROM products;The AVG function calculates the average (mean) of numeric values in a column.
Fix the error in the query to get the total quantity sold from sales.
SELECT [1](quantity) FROM sales;The SUM function adds all values in the quantity column to get the total sold.
Fill both blanks to get the number of orders per customer.
SELECT customer_id, [1](order_id) FROM orders GROUP BY [2];
We count orders per customer, so use COUNT(order_id) and group by customer_id.
Fill all three blanks to find the average price per category for products priced above 100.
SELECT [1], [2](price) FROM products WHERE price [3] 100 GROUP BY category;
We select the category, calculate the average price with AVG(price), filter prices greater than 100, and group by category.