Avg
The Average function will take a column or calculation over a table and return the arithmetic mean.
Syntax :
Avg(Expression, [Condition])
Parameters | Description |
---|---|
Expression | Column or Formula that an average is to be applied |
[Condition] | [OPTIONAL] - Calculation to determine if row should be included |
Example :
Table Name : Products
ProductID | Product Name | Price |
---|---|---|
1 | Pen | 6 |
2 | Pencil | 3 |
3 | Eraser | 2 |
4 | Bottle | 5 |
5 | Book | 10 |
Example 1
dAvg = AVG(Price)
DEBUG(dAvg)
Result :
dAvg
= 5.2
Example 2
dAvg = AVG(Price, Price>5)
DEBUG(dAvg)
Result :
dAvg
= 8