AVG

The function AVG returns the average value of items in a group. Without a GROUP BY clause it will return the average of all rows. This is equals to SUM( x ) / COUNT( x ).

SQL Syntax:
 
   AVG( expression )
Parameters:
 
  expression

A numeric expression without a aggregate function.

Return Type:
 
  the same as the expression.

Examples:

  • SELECT AVG( price ) FROM mytable
  • SELECT AVG( price ) FROM mytable
  • SELECT AVG( price ) FROM mytable t GROUP BY t.name

see also:
COUNT
SUM
SQL Aggregate Functions


100% pure Java DBMS
Mirror Site