SQL Basic
SQL Advanced
SQL Functions
| SQL avg() |
The AVG() FunctionThe AVG() function returns the average value of a numeric column. SQL AVG() Syntax
SQL AVG() ExampleWe have the following "Orders" table:
Now we want to find the average value of the "OrderPrice" fields. We use the following SQL statement:
The result-set will look like this:
Now we want to find the customers that have an OrderPrice value higher than the average OrderPrice value. We use the following SQL statement:
The result-set will look like this:
|
SQL avg()