4. Elements of QUEL Statements : Functions : Aggregate
 
Share this page                  
Aggregate
An aggregate function returns a single value based on the contents of a column. Aggregate functions are also called "set" functions. Aggregate functions can be nested.
The syntax for QUEL aggregate functions is as follows:
afunct(expr [by expr{expr}] [[only] where qual])
afunct
Denotes an aggregate function
expr
Donotes an expression representing a column or host variable
qual
Denotes a qualification. (Qualifications are explained below).
The following table lists aggregate functions:
Function
Data Type of Result
Value Returned
count()
i4
Number of entries in column
countu()
i4
Number of unique entries in column
sum()
i4, float8, money
Sum of values in column
sumu()
i4, float8, money
Sum of unique values in column
avg()
float8, money
Average of values in column
avgu()
float8, money
Average of unique values in column
max()
All types
Maximum value in column
min()
All types
Minimum value in column
any()
i2
Returns 1 if any rows satisfy the condition expressed by the argument; 0 if no rows satisfy the condition