SQL Sequence Project Function

The seq_project() function produces a sequence of the corresponding elements of the sequence specified in the second argument.

Following is an example script demonstrating the seq_project() function:

 
    SELECT symbol, seq_search(day, 20130101, 20130331) as Q1_13
        seq_project(close, Q1_13)
            
    FROM Quote WHERE symbol='SYM0';
     
    symbol
    Q1_13{}
      close_project{}
    ------------------------------------------------------------------------------
    SYM0 
    {20130101, 20130104, 20130106, 20130110, 20130123, 20130125, 20130129, 
      20130213, 20130214, 20130216, 20130311, 20130326} 
    { 62.83,  45.79,  74.73,  53.46,  67.87,  50.37,  80.32, 
       29.94,  25.92,  37.28,  80.92,  57.73}
     

In the example above, the “date” values 20130101 and 20130331 (integer values in format yyyymmdd) are used to return the sequence of day values for the first quarter of year 2013.

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:

     
    g 11