SQL AVG Function
Posted by JeffSep 19
SQL uses the AVG() function to calculate the average of a column.
The syntax for using this function is;
SELECT
AVG(“column_name”)
FROM
“table_name”
For example, if we want to get the average of all sales from the following table:
Store Sales Information
| Store Name | Sales |
|---|---|
| Atlanta | $1500 |
| Boston | $250 |
| LA | $300 |
| Dallas | $700 |
you would type in”
SELECT
AVG(Sales)
FROM
Store_Information
Result:
AVG(Sales) = $687.5
$687.5 represents the average of all Sales entries: ($1500 + $250 + $300 + $700) / 4.


Leave a Reply