# SQL Sequence Maxof and Minof functions

> The `seq_maxof()`and `seq_minof()` functions are binary functions taking 2 sequences as arguments and, for each corresponding pair of elements from the input sequences, return the sequence with greater or lesser element from each pair.

> For example:

>         XSQL>create table t(s sequence(int), q sequence(int));

>         XSQL>insert into t(s,q) values([1,2,3,4,5,6,7,8,9,10], [10,9,8,7,6,5,4,3,2,1]);

>         XSQL>select * from t;

>         s		q
>         --------------------------------------------------------------------

>         {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}	{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}

>         Selected records: 1

>         XSQL>select seq_maxof(s,q), seq_minof(s,q) from t;

>         #1		#2
>         --------------------------------------------------------------------

>         {10, 9, 8, 7, 6, 6, 7, 8, 9, 10}	{1, 2, 3, 4, 5, 5, 4, 3, 2, 1}

>         Selected records: 1