SQL Sequence Grand Aggregate Count, Max and Min Functions

The function seq_count() returns an integer count of the elements in the sequence; seq_max(), and seq_min() return the values of the maximum and minimum elements in the sequence.

Following is an example script demonstrating the seq_count(), seq_max() and seq_min() functions:

 
 
    INSERT INTO SimpleSequence(testNumber,iVal1)
    VALUES(1,'{-3,-2,-1,0,1,2,3}');
     
    SELECT iVal1, seq_count(iVal1) AS "count", seq_max(iVal1) AS "max", seq_min(iVal1) AS "min"
    FROM SimpleSequence WHERE testNumber = 1;
     
    iVal1{}
    count
    max
    min
    --------------------------------------------------------------------
    {-3, -2, -1, 0, 1, 2, 3}
    7
    3.000000
            
    -3.000000
            
     

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