# SQL Sequence Grand Aggregate Sum, Prd and Avg Functions

> The functions `seq_sum()`, `seq_prd()` and `seq_avg()` compute the sum, product and average of the values in the sequence and return a double value.

> Following is an example script demonstrating the `seq_sum()`, `seq_prd()` and `seq_avg()` functions:

>         INSERT INTO SimpleSequence(testNumber,fVal1)
>         VALUES(3,'{1.1,2.2,3.3}');

>         SELECT fVal1, seq_sum(fVal1) AS "sum", seq_prd(fVal1) AS "prd",
>             seq_avg(fVal1) AS "avg", seq_var(fVal1) AS "var", seq_dev(fVal1) AS "dev"
>         FROM SimpleSequence WHERE testNumber = 3;

>         fVal1{}
>         sum
>         prd
>         avg
>         ------------------------------------------------------------------------
>         {1.100000, 2.200000, 3.300000}
>         6.600000
>         7.986000
>         2.200000

> To verify the computations:

>         sum = 1.1 + 2.2 +.3.3 = 6.6
>         prd = 1.1  * 2.2 = 2.42 * 3.3 = 7.986
>         avg = 6.6 / 3 = 2.2

> ## Sample script

> A sample script to demonstrate this `select` statement using xSQL can be run from the `samples/xsql/scripts/financial` directory with the following command:

>         f 1