| Function syntax | Resullt |
|---|---|
| AVG(expression) | The average of the non-NULL values in the expression. |
| SUM(expression) | The total of the non-NULL values in the expression. |
| MIN(expression) | The lowest non-NULL value in the expression. |
| MAX(expression) | The highest non-NULL value in the expression. |
| COUNT(expression) | The number of non-NULL values in the expression. |
| COUNT(*) | The number of rows selected by the query. |
SELECT COUNT(*) AS productCount
FROM products;
SELECT COUNT(*) AS totalCount, COUNT(shipDate) AS shippedCount
FROM orders;
SELECT MIN(listPrice) AS lowestPrice, MAX(listPrice) AS highestPrice, AVG(listPrice) AS averagePrice
FROM products;
SELECT SUM(itemPrice * quantity – discountAmount) AS ordersTotal
FROM orderItems;
SELECT statement that includes an aggregate function can be called a summary query.SELECT clause, the SELECT clause can’t include non-aggregate columns from the base table.