Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Data Types and Expressions > Expression >

AVG Function

The AVG function returns the average of all values in the specified column or expression. You can apply the AVG function only to number columns. If you use the DISTINCT keyword, the average (meaning the mean) is calculated from only the distinct values in the specified column or expression. The query in the following example finds the average price of a helmet:

SELECT AVG(unit_price) FROM stock WHERE stock_num = 110

NULLs are ignored unless every value in the column is NULL. If every column value is NULL, the AVG function returns a NULL for that column.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]