Sample user-defined aggregates

This section provides the sample user-defined aggregates that the following table describes.
User-defined aggregate Description
SUMSQ Squares each value and calculates the sum of these squared values
SQSUM2 Sums all values and calculates the square of this sum
PERCENT_GTR Determines the percentage of values greater than a user-specified value
X_PERCENTILE Determines the value in a group of values that is the x-percentile, where x is a percent that the end user specifies.

Each description includes the aggregate support functions written in C and the SQL statements to define the user-defined aggregate in the database.