Binary SQL Functions

The following binary functions take two input sequences, left and right, and produce the result sequence of the same type.

The two input sequences must be of the same type. If the two input sequences are of different lengths the operation will be performed on only the number of elements in the shorter of the two sequences.

seq_add( left, right ) The element of the result sequence is the corresponding elements in left added to right
seq_sub( left, right ) The element of the result sequence is the corresponding elements in right subtracted from left
seq_mul( left, right ) The element of the result sequence is the corresponding elements in left multiplied byright
seq_div( left, right ) The element of the result sequence is the corresponding elements in left divided by right
seq_mod( left, right ) The element of the result sequence is the corresponding elements in left modulo right
seq_pow( left, right ) The elements of left are raised to the power of the corresponding elements right
seq_maxof( left, right ) Return the sequence consisting of the greater of the pairs of elements from left and right
seq_minof( left, right ) Return the sequence consisting of the lesser of the pairs of elements from left and right

Example

Following is an example code snippet demonstrating the binary functions:

         
    -- seq_add, seq_sub, seq_mul, seq_div
            
     
    INSERT INTO SimpleSequence(testNumber,dVal1,dVal2)
    VALUES(1,'{1,2}','{3,4}');
     
    SELECT dVal1,dVal2,seq_add(dVal1,dVal2) As "add" FROM SimpleSequence where testNumber=1;
    SELECT dVal1,dVal2,seq_sub(dVal1,dVal2) As "sub" FROM SimpleSequence where testNumber=1;
    SELECT dVal1,dVal2,seq_mul(dVal1,dVal2) As "mul" FROM SimpleSequence where testNumber=1;
    SELECT dVal1,dVal2,seq_div(dVal1,dVal2) As "div" FROM SimpleSequence where testNumber=1;
     
    dVal1{}
    dVal2{}
    add{}
    --------------------------------------------------------------------
    {1.000000, 2.000000}
    {3.000000, 4.000000}
    {4.000000, 6.000000}
     
    dVal1{}
    dVal2{}
    sub{}
    --------------------------------------------------------------------
    {1.000000, 2.000000}
    {3.000000, 4.000000}
    {-2.000000, -2.00000}
     
    dVal1{}
    dVal2{}
    mul{}
    --------------------------------------------------------------------
    {1.000000, 2.000000}
    {3.000000, 4.000000}
    {3.000000, 8.000000}
     
    dVal1{}
    dVal2{}
    div{}
    --------------------------------------------------------------------
    {1.000000, 2.000000}
    {3.000000, 4.000000}
    {0.333333, 0.500000}
     
    -- seq_mod
            
     
    INSERT INTO SimpleSequence(testNumber,dVal1,dVal2)
     
    VALUES(2,'{6,7}','{3,4}');
    SELECT dVal1,dVal2,seq_mod(dVal1,dVal2) As "mod" FROM SimpleSequence where testNumber=2;
     
    dVal1{}
    dVal2{}
    mod{}
    --------------------------------------------------------------------
    {6.000000, 7.000000}
    {3.000000, 4.000000}
    {0.000000, 3.000000}