SELECT SUM(quantityOrdered * priceEach) total FROM orderdetails WHERE orderNumber = 10100;
SELECT orderNumber, SUM(quantityOrdered * priceEach) total FROM orderdetails GROUP BY orderNumber ORDER BY SUM(quantityOrdered * priceEach) DESC;
SELECT orderNumber, SUM(quantityOrdered * priceEach) FROM orderdetails GROUP BY orderNumber HAVING SUM(quantityOrdered * priceEach) > 60000 ORDER BY SUM(quantityOrdered * priceEach);
SELECT SUM(buyprice) FROM products ORDER BY buyprice DESC LIMIT 10;
SELECT SUM(buyprice) FROM (SELECT buyprice FROM products ORDER BY buyprice DESC LIMIT 10) price;
SELECT COALESCE(SUM(quantityOrdered * priceEach),0) FROM orderdetails WHERE productCode = 'S1_20';
SELECT SUM(quantityOrdered * priceEach) loss FROM orderdetails INNER JOIN orders USING(orderNumber) WHERE status = 'Cancelled'