Count orders per customer:
SELECT customer_id, COUNT(*)
FROM orders
GROUP BY customer_id
Total sales by product:
SELECT product_id, SUM(amount)
FROM sales
GROUP BY product_id
All SELECT columns must be in GROUP BY or inside aggregate functions (COUNT, SUM, etc.).