A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: Aggregate Functions

avg()

The aggregate function avg() can be used to compute the average of numeric values.

Syntax of the aggregate function avg()

    avg( [ all | distinct ] expression )
    

Parameters of the aggregate function avg()

all
"all" returns the average of all values. "all" is the default parameter value of the function avg().

distinct
"distinct" avoids that duplicate values are taken into account. "distinct" this is an optional parameter.

expression
"expression" usually a place holder for a column name in the avg()-function.

Example for the aggregate function avg()

    select avg(number_of_orders) from table_name
    

    select avg(distinct number_of_orders) from table_name
    

See also:

ASE T-SQL - Aggregate Functions,
count(*),
count(),
count_big(),
max(),
min(),
sum().