SELECT status FROM orders GROUP BY status;
SELECT DISTINCT status FROM orders;
SELECT status, COUNT(*) FROM orders GROUP BY status;
SELECT status, SUM(quantityOrdered * priceEach) AS amount FROM orders INNER JOIN orderdetails USING (orderNumber) GROUP BY status;
SELECT orderNumber, SUM(quantityOrdered * priceEach) AS total FROM orderdetails GROUP BY orderNumber;
SELECT YEAR(orderDate) AS year, SUM(quantityOrdered * priceEach) AS total FROM orders INNER JOIN orderdetails USING (orderNumber) WHERE status = 'Shipped' GROUP BY YEAR(orderDate);
SELECT YEAR(orderDate) AS year, SUM(quantityOrdered * priceEach) AS total FROM orders INNER JOIN orderdetails USING (orderNumber) WHERE status = 'Shipped' GROUP BY year HAVING year > 2003;
SELECT YEAR(orderDate) AS year, COUNT(orderNumber) FROM orders GROUP BY year;
SELECT status, COUNT(*) FROM orders GROUP BY status DESC;