SQLite AVG() Function
Example
Return the average price of all the products:
SELECT AVG(Price) FROM Products;
Try it Yourself »
Definition and Usage
The AVG() function returns the average value of the values in a group. NULL values are skipped. The result is always a decimal number.
Tip: Also look at SUM(), COUNT().
Syntax
AVG(expression)
Parameter Values
| Parameter | Description |
|---|---|
| expression | Required. A column or a calculation |
Technical Details
| Return type: | Real |
|---|
More Examples
Example
Return the average price in each category:
SELECT CategoryID, AVG(Price)
FROM Products
GROUP BY CategoryID;
Try it Yourself »