/ Check-in [76543f7d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add support for window function cume_dist(). Improve tests for percent_rank().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | exp-window-functions
Files: files | file ages | folders
SHA3-256:76543f7dd3a2310f6e81a1bae17db9bb5d2cf10c1b87ed3f8394b3e75576078b
User & Date: dan 2018-06-04 08:22:09
Context
2018-06-04
08:28
Merge latest trunk changes into this branch. check-in: 83d6416a user: dan tags: exp-window-functions
08:22
Add support for window function cume_dist(). Improve tests for percent_rank(). check-in: 76543f7d user: dan tags: exp-window-functions
2018-06-02
21:04
Add support for window functions row_number(), rank(), dense_rank() and percent_rank(). check-in: 91c1cb7a user: dan tags: exp-window-functions
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/window.c.

   144    144         sqlite3_result_double(pCtx, r);
   145    145       }else{
   146    146         sqlite3_result_double(pCtx, 100.0);
   147    147       }
   148    148       p->nValue = 0;
   149    149     }
   150    150   }
          151  +
          152  +static void cume_distStepFunc(
          153  +  sqlite3_context *pCtx, 
          154  +  int nArg,
          155  +  sqlite3_value **apArg
          156  +){
          157  +  struct CallCount *p;
          158  +  assert( nArg==1 );
          159  +
          160  +  p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
          161  +  if( p ){
          162  +    if( p->nTotal==0 ){
          163  +      p->nTotal = sqlite3_value_int64(apArg[0]);
          164  +    }
          165  +    p->nStep++;
          166  +  }
          167  +}
          168  +static void cume_distInverseFunc(
          169  +  sqlite3_context *pCtx, 
          170  +  int nArg,
          171  +  sqlite3_value **apArg
          172  +){
          173  +}
          174  +static void cume_distValueFunc(sqlite3_context *pCtx){
          175  +  struct CallCount *p;
          176  +  p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
          177  +  if( p ){
          178  +    double r = (double)(p->nStep) / (double)(p->nTotal);
          179  +    sqlite3_result_double(pCtx, r);
          180  +  }
          181  +}
   151    182   
   152    183   static void nth_valueStepFunc(
   153    184     sqlite3_context *pCtx, 
   154    185     int nArg,
   155    186     sqlite3_value **apArg
   156    187   ){
   157    188   }
................................................................................
   175    206   */
   176    207   void sqlite3WindowFunctions(void){
   177    208     static FuncDef aWindowFuncs[] = {
   178    209       WINDOWFUNC(row_number, 0, 0),
   179    210       WINDOWFUNC(dense_rank, 0, 0),
   180    211       WINDOWFUNC(rank, 0, 0),
   181    212       WINDOWFUNC(percent_rank, 0, SQLITE_FUNC_WINDOW_SIZE),
          213  +    WINDOWFUNC(cume_dist, 0, SQLITE_FUNC_WINDOW_SIZE),
   182    214       WINDOWFUNC(nth_value, 2, 0),
   183    215     };
   184    216     sqlite3InsertBuiltinFuncs(aWindowFuncs, ArraySize(aWindowFuncs));
   185    217   }
   186    218   
   187    219   void sqlite3WindowUpdate(Parse *pParse, Window *pWin, FuncDef *pFunc){
   188    220     if( pFunc->funcFlags & SQLITE_FUNC_WINDOW ){
................................................................................
   193    225         pWin->pStart = pWin->pEnd = 0;
   194    226         pWin->eType = TK_ROWS;
   195    227         pWin->eStart = TK_UNBOUNDED;
   196    228         pWin->eEnd = TK_CURRENT;
   197    229       }
   198    230   
   199    231       if( pFunc->xSFunc==dense_rankStepFunc || pFunc->xSFunc==rankStepFunc
   200         -     || pFunc->xSFunc==percent_rankStepFunc
          232  +     || pFunc->xSFunc==percent_rankStepFunc || pFunc->xSFunc==cume_distStepFunc
   201    233       ){
   202    234         sqlite3ExprDelete(db, pWin->pStart);
   203    235         sqlite3ExprDelete(db, pWin->pEnd);
   204    236         pWin->pStart = pWin->pEnd = 0;
   205    237         pWin->eType = TK_RANGE;
   206    238         pWin->eStart = TK_UNBOUNDED;
   207    239         pWin->eEnd = TK_CURRENT;

Changes to test/pg_common.tcl.

    61     61   proc execsql_test {tn sql} {
    62     62     set res [execsql $sql]
    63     63     puts $::fd "do_execsql_test $tn {"
    64     64     puts $::fd "  [string trim $sql]"
    65     65     puts $::fd "} {$res}"
    66     66     puts $::fd ""
    67     67   }
           68  +
           69  +# Same as [execsql_test], except coerce all results to floating point values
           70  +# with two decimal points.
           71  +#
           72  +proc execsql_float_test {tn sql} {
           73  +  set F "%.2f"
           74  +  set res [execsql $sql]
           75  +  set res2 [list]
           76  +  foreach r $res { lappend res2 [format $F $r] }
           77  +
           78  +  puts $::fd "do_test $tn {"
           79  +  puts $::fd "  set myres {}"
           80  +  puts $::fd "  foreach r \[db eval {[string trim $sql]}\] {"
           81  +  puts $::fd "    lappend myres \[format $F \[set r\]\]"
           82  +  puts $::fd "  }"
           83  +  puts $::fd "  set myres"
           84  +  puts $::fd "} {$res2}"
           85  +  puts $::fd ""
           86  +}
    68     87   
    69     88   proc start_test {name date} {
    70     89     set dir [file dirname $::argv0]
    71     90     set output [file join $dir $name.test]
    72     91     set ::fd [open $output w]
    73     92   puts $::fd [string trimleft "
    74     93   # $date

Changes to test/window3.tcl.

   125    125       SELECT 
   126    126         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 $window ),
   127    127         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 $window ),
   128    128         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 $window )
   129    129       FROM t2
   130    130     "
   131    131   
   132         -  execsql_test 1.$tn.7.1 "
   133         -  SELECT CAST( round( 100 * 
   134         -      percent_rank() OVER ( ORDER BY a $window )
   135         -  ) AS integer) FROM t2"
   136         -
   137         -  #execsql_test 1.$tn.7.2 "
   138         -  #SELECT CAST( round( 100 * 
   139         -      #percent_rank() OVER ( PARTITION BY b%10 ORDER BY a $window )
   140         -  #) AS integer) FROM t2"
   141         -
   142         -  execsql_test 1.$tn.7.3 "
   143         -  SELECT CAST( round( 100 * 
   144         -      percent_rank() OVER ( ORDER BY b $window )
   145         -  ) AS integer) FROM t2"
          132  +  execsql_float_test 1.$tn.7.1 "
          133  +    SELECT percent_rank() OVER ( ORDER BY a $window ) FROM t2
          134  +  "
          135  +  execsql_float_test 1.$tn.7.2 "
          136  +    SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a $window ) FROM t2
          137  +  "
          138  +  execsql_float_test 1.$tn.7.3 "
          139  +    SELECT percent_rank() OVER ( ORDER BY b $window ) FROM t2
          140  +  "
          141  +  execsql_float_test 1.$tn.7.4 "
          142  +    SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b $window ) FROM t2
          143  +  "
          144  +  execsql_float_test 1.$tn.7.5 "
          145  +    SELECT percent_rank() OVER ( ORDER BY b%10 $window ) FROM t2
          146  +  "
          147  +  execsql_float_test 1.$tn.7.6 "
          148  +    SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 $window ) FROM t2
          149  +  "
   146    150   
   147         -  #execsql_test 1.$tn.7.4 "
   148         -  #SELECT CAST( round( 100 * 
   149         -      #percent_rank() OVER ( PARTITION BY b%10 ORDER BY b $window )
   150         -  #) AS integer) FROM t2"
   151         -
   152         -  execsql_test 1.$tn.7.5 "
   153         -  SELECT CAST( round( 100 * 
   154         -      percent_rank() OVER ( ORDER BY b%10 $window )
   155         -  ) AS integer) FROM t2"
   156         -
   157         -  execsql_test 1.$tn.7.6 "
   158         -  SELECT CAST( round( 100 * 
   159         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 $window )
   160         -  ) AS integer) FROM t2"
   161         -
          151  +  execsql_float_test 1.$tn.8.1 "
          152  +    SELECT cume_dist() OVER ( ORDER BY a $window ) FROM t2
          153  +  "
          154  +  execsql_float_test 1.$tn.8.2 "
          155  +    SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a $window ) FROM t2
          156  +  "
          157  +  execsql_float_test 1.$tn.8.3 "
          158  +    SELECT cume_dist() OVER ( ORDER BY b $window ) FROM t2
          159  +  "
          160  +  execsql_float_test 1.$tn.8.4 "
          161  +    SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b $window ) FROM t2
          162  +  "
          163  +  execsql_float_test 1.$tn.8.5 "
          164  +    SELECT cume_dist() OVER ( ORDER BY b%10 $window ) FROM t2
          165  +  "
          166  +  execsql_float_test 1.$tn.8.6 "
          167  +    SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 $window ) FROM t2
          168  +  "
   162    169   
   163    170   }
   164    171   
   165    172   
   166    173   finish_test
   167    174   

Changes to test/window3.test.

   125    125     SELECT 
   126    126         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
   127    127         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
   128    128         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   129    129       FROM t2
   130    130   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   131    131   
   132         -do_execsql_test 1.1.7.1 {
   133         -  SELECT CAST( round( 100 * 
   134         -      percent_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   135         -  ) AS integer) FROM t2
   136         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   137         -
   138         -do_execsql_test 1.1.7.3 {
   139         -  SELECT CAST( round( 100 * 
   140         -      percent_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   141         -  ) AS integer) FROM t2
   142         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   143         -
   144         -do_execsql_test 1.1.7.5 {
   145         -  SELECT CAST( round( 100 * 
   146         -      percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   147         -  ) AS integer) FROM t2
   148         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   149         -
   150         -do_execsql_test 1.1.7.6 {
   151         -  SELECT CAST( round( 100 * 
   152         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   153         -  ) AS integer) FROM t2
   154         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
          132  +do_test 1.1.7.1 {
          133  +  set myres {}
          134  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          135  +    lappend myres [format %.2f [set r]]
          136  +  }
          137  +  set myres
          138  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
          139  +
          140  +do_test 1.1.7.2 {
          141  +  set myres {}
          142  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          143  +    lappend myres [format %.2f [set r]]
          144  +  }
          145  +  set myres
          146  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
          147  +
          148  +do_test 1.1.7.3 {
          149  +  set myres {}
          150  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          151  +    lappend myres [format %.2f [set r]]
          152  +  }
          153  +  set myres
          154  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
          155  +
          156  +do_test 1.1.7.4 {
          157  +  set myres {}
          158  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          159  +    lappend myres [format %.2f [set r]]
          160  +  }
          161  +  set myres
          162  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
          163  +
          164  +do_test 1.1.7.5 {
          165  +  set myres {}
          166  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          167  +    lappend myres [format %.2f [set r]]
          168  +  }
          169  +  set myres
          170  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
          171  +
          172  +do_test 1.1.7.6 {
          173  +  set myres {}
          174  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          175  +    lappend myres [format %.2f [set r]]
          176  +  }
          177  +  set myres
          178  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
          179  +
          180  +do_test 1.1.8.1 {
          181  +  set myres {}
          182  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          183  +    lappend myres [format %.2f [set r]]
          184  +  }
          185  +  set myres
          186  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   155    187   
   156    188   do_execsql_test 1.2.2.1 {
   157    189     SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
   158    190   } {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}
   159    191   
   160    192   do_execsql_test 1.2.2.2 {
   161    193     SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
................................................................................
   221    253     SELECT 
   222    254         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
   223    255         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
   224    256         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
   225    257       FROM t2
   226    258   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   227    259   
   228         -do_execsql_test 1.2.7.1 {
   229         -  SELECT CAST( round( 100 * 
   230         -      percent_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
   231         -  ) AS integer) FROM t2
   232         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   233         -
   234         -do_execsql_test 1.2.7.3 {
   235         -  SELECT CAST( round( 100 * 
   236         -      percent_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
   237         -  ) AS integer) FROM t2
   238         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   239         -
   240         -do_execsql_test 1.2.7.5 {
   241         -  SELECT CAST( round( 100 * 
   242         -      percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
   243         -  ) AS integer) FROM t2
   244         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   245         -
   246         -do_execsql_test 1.2.7.6 {
   247         -  SELECT CAST( round( 100 * 
   248         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
   249         -  ) AS integer) FROM t2
   250         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
          260  +do_test 1.2.7.1 {
          261  +  set myres {}
          262  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
          263  +    lappend myres [format %.2f [set r]]
          264  +  }
          265  +  set myres
          266  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
          267  +
          268  +do_test 1.2.7.2 {
          269  +  set myres {}
          270  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
          271  +    lappend myres [format %.2f [set r]]
          272  +  }
          273  +  set myres
          274  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
          275  +
          276  +do_test 1.2.7.3 {
          277  +  set myres {}
          278  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
          279  +    lappend myres [format %.2f [set r]]
          280  +  }
          281  +  set myres
          282  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
          283  +
          284  +do_test 1.2.7.4 {
          285  +  set myres {}
          286  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
          287  +    lappend myres [format %.2f [set r]]
          288  +  }
          289  +  set myres
          290  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
          291  +
          292  +do_test 1.2.7.5 {
          293  +  set myres {}
          294  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
          295  +    lappend myres [format %.2f [set r]]
          296  +  }
          297  +  set myres
          298  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
          299  +
          300  +do_test 1.2.7.6 {
          301  +  set myres {}
          302  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
          303  +    lappend myres [format %.2f [set r]]
          304  +  }
          305  +  set myres
          306  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
          307  +
          308  +do_test 1.2.8.1 {
          309  +  set myres {}
          310  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
          311  +    lappend myres [format %.2f [set r]]
          312  +  }
          313  +  set myres
          314  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   251    315   
   252    316   do_execsql_test 1.3.2.1 {
   253    317     SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
   254    318   } {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}
   255    319   
   256    320   do_execsql_test 1.3.2.2 {
   257    321     SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
................................................................................
   317    381     SELECT 
   318    382         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ),
   319    383         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ),
   320    384         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW )
   321    385       FROM t2
   322    386   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   323    387   
   324         -do_execsql_test 1.3.7.1 {
   325         -  SELECT CAST( round( 100 * 
   326         -      percent_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW )
   327         -  ) AS integer) FROM t2
   328         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   329         -
   330         -do_execsql_test 1.3.7.3 {
   331         -  SELECT CAST( round( 100 * 
   332         -      percent_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW         AND CURRENT ROW )
   333         -  ) AS integer) FROM t2
   334         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   335         -
   336         -do_execsql_test 1.3.7.5 {
   337         -  SELECT CAST( round( 100 * 
   338         -      percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW )
   339         -  ) AS integer) FROM t2
   340         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   341         -
   342         -do_execsql_test 1.3.7.6 {
   343         -  SELECT CAST( round( 100 * 
   344         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW )
   345         -  ) AS integer) FROM t2
   346         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
          388  +do_test 1.3.7.1 {
          389  +  set myres {}
          390  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
          391  +    lappend myres [format %.2f [set r]]
          392  +  }
          393  +  set myres
          394  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
          395  +
          396  +do_test 1.3.7.2 {
          397  +  set myres {}
          398  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
          399  +    lappend myres [format %.2f [set r]]
          400  +  }
          401  +  set myres
          402  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
          403  +
          404  +do_test 1.3.7.3 {
          405  +  set myres {}
          406  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
          407  +    lappend myres [format %.2f [set r]]
          408  +  }
          409  +  set myres
          410  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
          411  +
          412  +do_test 1.3.7.4 {
          413  +  set myres {}
          414  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
          415  +    lappend myres [format %.2f [set r]]
          416  +  }
          417  +  set myres
          418  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
          419  +
          420  +do_test 1.3.7.5 {
          421  +  set myres {}
          422  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
          423  +    lappend myres [format %.2f [set r]]
          424  +  }
          425  +  set myres
          426  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
          427  +
          428  +do_test 1.3.7.6 {
          429  +  set myres {}
          430  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
          431  +    lappend myres [format %.2f [set r]]
          432  +  }
          433  +  set myres
          434  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
          435  +
          436  +do_test 1.3.8.1 {
          437  +  set myres {}
          438  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
          439  +    lappend myres [format %.2f [set r]]
          440  +  }
          441  +  set myres
          442  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   347    443   
   348    444   do_execsql_test 1.4.2.1 {
   349    445     SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
   350    446   } {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7}
   351    447   
   352    448   do_execsql_test 1.4.2.2 {
   353    449     SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
................................................................................
   413    509     SELECT 
   414    510         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ),
   415    511         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ),
   416    512         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
   417    513       FROM t2
   418    514   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   419    515   
   420         -do_execsql_test 1.4.7.1 {
   421         -  SELECT CAST( round( 100 * 
   422         -      percent_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
   423         -  ) AS integer) FROM t2
   424         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   425         -
   426         -do_execsql_test 1.4.7.3 {
   427         -  SELECT CAST( round( 100 * 
   428         -      percent_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
   429         -  ) AS integer) FROM t2
   430         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   431         -
   432         -do_execsql_test 1.4.7.5 {
   433         -  SELECT CAST( round( 100 * 
   434         -      percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
   435         -  ) AS integer) FROM t2
   436         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   437         -
   438         -do_execsql_test 1.4.7.6 {
   439         -  SELECT CAST( round( 100 * 
   440         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
   441         -  ) AS integer) FROM t2
   442         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
          516  +do_test 1.4.7.1 {
          517  +  set myres {}
          518  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
          519  +    lappend myres [format %.2f [set r]]
          520  +  }
          521  +  set myres
          522  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
          523  +
          524  +do_test 1.4.7.2 {
          525  +  set myres {}
          526  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
          527  +    lappend myres [format %.2f [set r]]
          528  +  }
          529  +  set myres
          530  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
          531  +
          532  +do_test 1.4.7.3 {
          533  +  set myres {}
          534  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
          535  +    lappend myres [format %.2f [set r]]
          536  +  }
          537  +  set myres
          538  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
          539  +
          540  +do_test 1.4.7.4 {
          541  +  set myres {}
          542  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
          543  +    lappend myres [format %.2f [set r]]
          544  +  }
          545  +  set myres
          546  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
          547  +
          548  +do_test 1.4.7.5 {
          549  +  set myres {}
          550  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
          551  +    lappend myres [format %.2f [set r]]
          552  +  }
          553  +  set myres
          554  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
          555  +
          556  +do_test 1.4.7.6 {
          557  +  set myres {}
          558  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
          559  +    lappend myres [format %.2f [set r]]
          560  +  }
          561  +  set myres
          562  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
          563  +
          564  +do_test 1.4.8.1 {
          565  +  set myres {}
          566  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
          567  +    lappend myres [format %.2f [set r]]
          568  +  }
          569  +  set myres
          570  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   443    571   
   444    572   do_execsql_test 1.5.2.1 {
   445    573     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
   446    574   } {{}   {}   {}   {}   0   74   74   74   74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}
   447    575   
   448    576   do_execsql_test 1.5.2.2 {
   449    577     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
................................................................................
   509    637     SELECT 
   510    638         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ),
   511    639         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ),
   512    640         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING )
   513    641       FROM t2
   514    642   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   515    643   
   516         -do_execsql_test 1.5.7.1 {
   517         -  SELECT CAST( round( 100 * 
   518         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING )
   519         -  ) AS integer) FROM t2
   520         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   521         -
   522         -do_execsql_test 1.5.7.3 {
   523         -  SELECT CAST( round( 100 * 
   524         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING )
   525         -  ) AS integer) FROM t2
   526         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   527         -
   528         -do_execsql_test 1.5.7.5 {
   529         -  SELECT CAST( round( 100 * 
   530         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING )
   531         -  ) AS integer) FROM t2
   532         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   533         -
   534         -do_execsql_test 1.5.7.6 {
   535         -  SELECT CAST( round( 100 * 
   536         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING )
   537         -  ) AS integer) FROM t2
   538         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
          644  +do_test 1.5.7.1 {
          645  +  set myres {}
          646  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
          647  +    lappend myres [format %.2f [set r]]
          648  +  }
          649  +  set myres
          650  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
          651  +
          652  +do_test 1.5.7.2 {
          653  +  set myres {}
          654  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
          655  +    lappend myres [format %.2f [set r]]
          656  +  }
          657  +  set myres
          658  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
          659  +
          660  +do_test 1.5.7.3 {
          661  +  set myres {}
          662  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
          663  +    lappend myres [format %.2f [set r]]
          664  +  }
          665  +  set myres
          666  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
          667  +
          668  +do_test 1.5.7.4 {
          669  +  set myres {}
          670  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
          671  +    lappend myres [format %.2f [set r]]
          672  +  }
          673  +  set myres
          674  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
          675  +
          676  +do_test 1.5.7.5 {
          677  +  set myres {}
          678  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
          679  +    lappend myres [format %.2f [set r]]
          680  +  }
          681  +  set myres
          682  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
          683  +
          684  +do_test 1.5.7.6 {
          685  +  set myres {}
          686  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
          687  +    lappend myres [format %.2f [set r]]
          688  +  }
          689  +  set myres
          690  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
          691  +
          692  +do_test 1.5.8.1 {
          693  +  set myres {}
          694  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
          695  +    lappend myres [format %.2f [set r]]
          696  +  }
          697  +  set myres
          698  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   539    699   
   540    700   do_execsql_test 1.6.2.1 {
   541    701     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
   542    702   } {{}   {}   0   74   74   74   74   99   99   99   33   89   89   96   96   96   68   68   68   91   91   91   99   99   99   97   78   78   97   97   97   67   93   93   93   84   77   23   93   93   93   65   47   86   86   86   91   91   91   85   85   85   59   59   56   56   91   91   91   90   90   55   89   89   89   47   56   56   56   56   56   75   75   89   98   98   98   81   94   94   94   78   78   78   53   63   63   87   87   87   84   84   84   72   61   73   95   95   95   65   96   98   98   98   74   74   74   65   73   73   73   87   87   87   41   20   31   31   31   95   95   95   79   88   88   88   34   49   49   90   90   96   96   96   75   77   77   77   44   85   85   85   74   74   70   70   59   39   39   47   80   90   90   90   58   58   72   72   72   72   93   93   93   81   81   81   37   37   37   14   62   91   91   91   91   91   34   36   99   99   99   95   95   69   58   52   84   84   84   84   84   39   44   58   58   58   38   83   83   83}
   543    703   
   544    704   do_execsql_test 1.6.2.2 {
   545    705     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
................................................................................
   605    765     SELECT 
   606    766         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ),
   607    767         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ),
   608    768         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING )
   609    769       FROM t2
   610    770   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   611    771   
   612         -do_execsql_test 1.6.7.1 {
   613         -  SELECT CAST( round( 100 * 
   614         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING )
   615         -  ) AS integer) FROM t2
   616         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   617         -
   618         -do_execsql_test 1.6.7.3 {
   619         -  SELECT CAST( round( 100 * 
   620         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING )
   621         -  ) AS integer) FROM t2
   622         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   623         -
   624         -do_execsql_test 1.6.7.5 {
   625         -  SELECT CAST( round( 100 * 
   626         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING )
   627         -  ) AS integer) FROM t2
   628         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   629         -
   630         -do_execsql_test 1.6.7.6 {
   631         -  SELECT CAST( round( 100 * 
   632         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING )
   633         -  ) AS integer) FROM t2
   634         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
          772  +do_test 1.6.7.1 {
          773  +  set myres {}
          774  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2}] {
          775  +    lappend myres [format %.2f [set r]]
          776  +  }
          777  +  set myres
          778  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
          779  +
          780  +do_test 1.6.7.2 {
          781  +  set myres {}
          782  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2}] {
          783  +    lappend myres [format %.2f [set r]]
          784  +  }
          785  +  set myres
          786  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
          787  +
          788  +do_test 1.6.7.3 {
          789  +  set myres {}
          790  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2}] {
          791  +    lappend myres [format %.2f [set r]]
          792  +  }
          793  +  set myres
          794  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
          795  +
          796  +do_test 1.6.7.4 {
          797  +  set myres {}
          798  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2}] {
          799  +    lappend myres [format %.2f [set r]]
          800  +  }
          801  +  set myres
          802  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
          803  +
          804  +do_test 1.6.7.5 {
          805  +  set myres {}
          806  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2}] {
          807  +    lappend myres [format %.2f [set r]]
          808  +  }
          809  +  set myres
          810  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
          811  +
          812  +do_test 1.6.7.6 {
          813  +  set myres {}
          814  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2}] {
          815  +    lappend myres [format %.2f [set r]]
          816  +  }
          817  +  set myres
          818  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
          819  +
          820  +do_test 1.6.8.1 {
          821  +  set myres {}
          822  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2}] {
          823  +    lappend myres [format %.2f [set r]]
          824  +  }
          825  +  set myres
          826  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   635    827   
   636    828   do_execsql_test 1.7.2.1 {
   637    829     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
   638    830   } {0   74   74   74   74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}
   639    831   
   640    832   do_execsql_test 1.7.2.2 {
   641    833     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
................................................................................
   701    893     SELECT 
   702    894         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
   703    895         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
   704    896         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   705    897       FROM t2
   706    898   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   707    899   
   708         -do_execsql_test 1.7.7.1 {
   709         -  SELECT CAST( round( 100 * 
   710         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   711         -  ) AS integer) FROM t2
   712         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   713         -
   714         -do_execsql_test 1.7.7.3 {
   715         -  SELECT CAST( round( 100 * 
   716         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   717         -  ) AS integer) FROM t2
   718         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   719         -
   720         -do_execsql_test 1.7.7.5 {
   721         -  SELECT CAST( round( 100 * 
   722         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   723         -  ) AS integer) FROM t2
   724         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   725         -
   726         -do_execsql_test 1.7.7.6 {
   727         -  SELECT CAST( round( 100 * 
   728         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
   729         -  ) AS integer) FROM t2
   730         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
          900  +do_test 1.7.7.1 {
          901  +  set myres {}
          902  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          903  +    lappend myres [format %.2f [set r]]
          904  +  }
          905  +  set myres
          906  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
          907  +
          908  +do_test 1.7.7.2 {
          909  +  set myres {}
          910  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          911  +    lappend myres [format %.2f [set r]]
          912  +  }
          913  +  set myres
          914  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
          915  +
          916  +do_test 1.7.7.3 {
          917  +  set myres {}
          918  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          919  +    lappend myres [format %.2f [set r]]
          920  +  }
          921  +  set myres
          922  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
          923  +
          924  +do_test 1.7.7.4 {
          925  +  set myres {}
          926  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          927  +    lappend myres [format %.2f [set r]]
          928  +  }
          929  +  set myres
          930  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
          931  +
          932  +do_test 1.7.7.5 {
          933  +  set myres {}
          934  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          935  +    lappend myres [format %.2f [set r]]
          936  +  }
          937  +  set myres
          938  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
          939  +
          940  +do_test 1.7.7.6 {
          941  +  set myres {}
          942  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          943  +    lappend myres [format %.2f [set r]]
          944  +  }
          945  +  set myres
          946  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
          947  +
          948  +do_test 1.7.8.1 {
          949  +  set myres {}
          950  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
          951  +    lappend myres [format %.2f [set r]]
          952  +  }
          953  +  set myres
          954  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   731    955   
   732    956   do_execsql_test 1.8.2.1 {
   733    957     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
   734    958   } {0   74   74   74   74   99   99   99   99   99   89   96   96   96   96   96   68   91   91   91   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   84   93   93   93   93   93   86   86   86   91   91   91   91   91   85   85   85   59   59   91   91   91   91   91   90   90   89   89   89   89   56   56   56   56   75   75   89   98   98   98   98   98   94   94   94   94   78   78   78   63   87   87   87   87   87   84   84   84   73   95   95   95   95   96   98   98   98   98   98   74   74   74   73   73   87   87   87   87   87   41   31   31   95   95   95   95   95   88   88   88   88   49   90   90   96   96   96   96   96   77   77   77   85   85   85   85   85   74   74   70   70   59   47   80   90   90   90   90   90   72   72   72   72   93   93   93   93   93   81   81   81   37   37   62   91   91   91   91   91   91   91   99   99   99   99   99   95   95   69   84   84   84   84   84   84   84   58   58   58   58   83   83   83   83   83}
   735    959   
   736    960   do_execsql_test 1.8.2.2 {
   737    961     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
................................................................................
   797   1021     SELECT 
   798   1022         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ),
   799   1023         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ),
   800   1024         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW )
   801   1025       FROM t2
   802   1026   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   803   1027   
   804         -do_execsql_test 1.8.7.1 {
   805         -  SELECT CAST( round( 100 * 
   806         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW )
   807         -  ) AS integer) FROM t2
   808         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   809         -
   810         -do_execsql_test 1.8.7.3 {
   811         -  SELECT CAST( round( 100 * 
   812         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW )
   813         -  ) AS integer) FROM t2
   814         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   815         -
   816         -do_execsql_test 1.8.7.5 {
   817         -  SELECT CAST( round( 100 * 
   818         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW )
   819         -  ) AS integer) FROM t2
   820         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   821         -
   822         -do_execsql_test 1.8.7.6 {
   823         -  SELECT CAST( round( 100 * 
   824         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW )
   825         -  ) AS integer) FROM t2
   826         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1028  +do_test 1.8.7.1 {
         1029  +  set myres {}
         1030  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2}] {
         1031  +    lappend myres [format %.2f [set r]]
         1032  +  }
         1033  +  set myres
         1034  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1035  +
         1036  +do_test 1.8.7.2 {
         1037  +  set myres {}
         1038  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2}] {
         1039  +    lappend myres [format %.2f [set r]]
         1040  +  }
         1041  +  set myres
         1042  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1043  +
         1044  +do_test 1.8.7.3 {
         1045  +  set myres {}
         1046  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2}] {
         1047  +    lappend myres [format %.2f [set r]]
         1048  +  }
         1049  +  set myres
         1050  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1051  +
         1052  +do_test 1.8.7.4 {
         1053  +  set myres {}
         1054  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2}] {
         1055  +    lappend myres [format %.2f [set r]]
         1056  +  }
         1057  +  set myres
         1058  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1059  +
         1060  +do_test 1.8.7.5 {
         1061  +  set myres {}
         1062  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2}] {
         1063  +    lappend myres [format %.2f [set r]]
         1064  +  }
         1065  +  set myres
         1066  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1067  +
         1068  +do_test 1.8.7.6 {
         1069  +  set myres {}
         1070  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2}] {
         1071  +    lappend myres [format %.2f [set r]]
         1072  +  }
         1073  +  set myres
         1074  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1075  +
         1076  +do_test 1.8.8.1 {
         1077  +  set myres {}
         1078  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2}] {
         1079  +    lappend myres [format %.2f [set r]]
         1080  +  }
         1081  +  set myres
         1082  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   827   1083   
   828   1084   do_execsql_test 1.9.2.1 {
   829   1085     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
   830   1086   } {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}
   831   1087   
   832   1088   do_execsql_test 1.9.2.2 {
   833   1089     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
................................................................................
   893   1149     SELECT 
   894   1150         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ),
   895   1151         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ),
   896   1152         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW )
   897   1153       FROM t2
   898   1154   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   899   1155   
   900         -do_execsql_test 1.9.7.1 {
   901         -  SELECT CAST( round( 100 * 
   902         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW )
   903         -  ) AS integer) FROM t2
   904         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
   905         -
   906         -do_execsql_test 1.9.7.3 {
   907         -  SELECT CAST( round( 100 * 
   908         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND CURRENT ROW )
   909         -  ) AS integer) FROM t2
   910         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
   911         -
   912         -do_execsql_test 1.9.7.5 {
   913         -  SELECT CAST( round( 100 * 
   914         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW )
   915         -  ) AS integer) FROM t2
   916         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
   917         -
   918         -do_execsql_test 1.9.7.6 {
   919         -  SELECT CAST( round( 100 * 
   920         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW )
   921         -  ) AS integer) FROM t2
   922         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1156  +do_test 1.9.7.1 {
         1157  +  set myres {}
         1158  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
         1159  +    lappend myres [format %.2f [set r]]
         1160  +  }
         1161  +  set myres
         1162  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1163  +
         1164  +do_test 1.9.7.2 {
         1165  +  set myres {}
         1166  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
         1167  +    lappend myres [format %.2f [set r]]
         1168  +  }
         1169  +  set myres
         1170  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1171  +
         1172  +do_test 1.9.7.3 {
         1173  +  set myres {}
         1174  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
         1175  +    lappend myres [format %.2f [set r]]
         1176  +  }
         1177  +  set myres
         1178  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1179  +
         1180  +do_test 1.9.7.4 {
         1181  +  set myres {}
         1182  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
         1183  +    lappend myres [format %.2f [set r]]
         1184  +  }
         1185  +  set myres
         1186  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1187  +
         1188  +do_test 1.9.7.5 {
         1189  +  set myres {}
         1190  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
         1191  +    lappend myres [format %.2f [set r]]
         1192  +  }
         1193  +  set myres
         1194  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1195  +
         1196  +do_test 1.9.7.6 {
         1197  +  set myres {}
         1198  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
         1199  +    lappend myres [format %.2f [set r]]
         1200  +  }
         1201  +  set myres
         1202  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1203  +
         1204  +do_test 1.9.8.1 {
         1205  +  set myres {}
         1206  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2}] {
         1207  +    lappend myres [format %.2f [set r]]
         1208  +  }
         1209  +  set myres
         1210  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
   923   1211   
   924   1212   do_execsql_test 1.10.2.1 {
   925   1213     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
   926   1214   } {74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}
   927   1215   
   928   1216   do_execsql_test 1.10.2.2 {
   929   1217     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
................................................................................
   989   1277     SELECT 
   990   1278         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ),
   991   1279         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ),
   992   1280         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING )
   993   1281       FROM t2
   994   1282   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
   995   1283   
   996         -do_execsql_test 1.10.7.1 {
   997         -  SELECT CAST( round( 100 * 
   998         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING )
   999         -  ) AS integer) FROM t2
  1000         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
  1001         -
  1002         -do_execsql_test 1.10.7.3 {
  1003         -  SELECT CAST( round( 100 * 
  1004         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING )
  1005         -  ) AS integer) FROM t2
  1006         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
  1007         -
  1008         -do_execsql_test 1.10.7.5 {
  1009         -  SELECT CAST( round( 100 * 
  1010         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING )
  1011         -  ) AS integer) FROM t2
  1012         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1013         -
  1014         -do_execsql_test 1.10.7.6 {
  1015         -  SELECT CAST( round( 100 * 
  1016         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING )
  1017         -  ) AS integer) FROM t2
  1018         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1284  +do_test 1.10.7.1 {
         1285  +  set myres {}
         1286  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
         1287  +    lappend myres [format %.2f [set r]]
         1288  +  }
         1289  +  set myres
         1290  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1291  +
         1292  +do_test 1.10.7.2 {
         1293  +  set myres {}
         1294  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
         1295  +    lappend myres [format %.2f [set r]]
         1296  +  }
         1297  +  set myres
         1298  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1299  +
         1300  +do_test 1.10.7.3 {
         1301  +  set myres {}
         1302  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
         1303  +    lappend myres [format %.2f [set r]]
         1304  +  }
         1305  +  set myres
         1306  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1307  +
         1308  +do_test 1.10.7.4 {
         1309  +  set myres {}
         1310  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
         1311  +    lappend myres [format %.2f [set r]]
         1312  +  }
         1313  +  set myres
         1314  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1315  +
         1316  +do_test 1.10.7.5 {
         1317  +  set myres {}
         1318  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
         1319  +    lappend myres [format %.2f [set r]]
         1320  +  }
         1321  +  set myres
         1322  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1323  +
         1324  +do_test 1.10.7.6 {
         1325  +  set myres {}
         1326  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
         1327  +    lappend myres [format %.2f [set r]]
         1328  +  }
         1329  +  set myres
         1330  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1331  +
         1332  +do_test 1.10.8.1 {
         1333  +  set myres {}
         1334  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
         1335  +    lappend myres [format %.2f [set r]]
         1336  +  }
         1337  +  set myres
         1338  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1019   1339   
  1020   1340   do_execsql_test 1.11.2.1 {
  1021   1341     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
  1022   1342   } {74   74   74   99   99   99   99   99   99   99   96   96   96   96   96   96   91   91   99   99   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   93   93   93   93   93   93   86   91   91   91   91   91   91   91   85   85   85   91   91   91   91   91   91   91   90   90   89   89   89   89   56   56   75   75   89   98   98   98   98   98   98   98   94   94   94   94   78   78   87   87   87   87   87   87   87   84   84   95   95   95   95   96   98   98   98   98   98   98   98   74   74   74   87   87   87   87   87   87   87   41   95   95   95   95   95   95   95   88   88   88   90   90   96   96   96   96   96   96   96   77   85   85   85   85   85   85   85   74   74   70   70   80   90   90   90   90   90   90   90   72   72   93   93   93   93   93   93   93   81   81   81   62   91   91   91   91   91   91   91   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   58   58   83   83   83   83   83   83   83}
  1023   1343   
  1024   1344   do_execsql_test 1.11.2.2 {
  1025   1345     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
................................................................................
  1085   1405     SELECT 
  1086   1406         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ),
  1087   1407         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ),
  1088   1408         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING )
  1089   1409       FROM t2
  1090   1410   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
  1091   1411   
  1092         -do_execsql_test 1.11.7.1 {
  1093         -  SELECT CAST( round( 100 * 
  1094         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING )
  1095         -  ) AS integer) FROM t2
  1096         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
  1097         -
  1098         -do_execsql_test 1.11.7.3 {
  1099         -  SELECT CAST( round( 100 * 
  1100         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING )
  1101         -  ) AS integer) FROM t2
  1102         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
  1103         -
  1104         -do_execsql_test 1.11.7.5 {
  1105         -  SELECT CAST( round( 100 * 
  1106         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING )
  1107         -  ) AS integer) FROM t2
  1108         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1109         -
  1110         -do_execsql_test 1.11.7.6 {
  1111         -  SELECT CAST( round( 100 * 
  1112         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING )
  1113         -  ) AS integer) FROM t2
  1114         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1412  +do_test 1.11.7.1 {
         1413  +  set myres {}
         1414  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2}] {
         1415  +    lappend myres [format %.2f [set r]]
         1416  +  }
         1417  +  set myres
         1418  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1419  +
         1420  +do_test 1.11.7.2 {
         1421  +  set myres {}
         1422  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2}] {
         1423  +    lappend myres [format %.2f [set r]]
         1424  +  }
         1425  +  set myres
         1426  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1427  +
         1428  +do_test 1.11.7.3 {
         1429  +  set myres {}
         1430  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2}] {
         1431  +    lappend myres [format %.2f [set r]]
         1432  +  }
         1433  +  set myres
         1434  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1435  +
         1436  +do_test 1.11.7.4 {
         1437  +  set myres {}
         1438  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2}] {
         1439  +    lappend myres [format %.2f [set r]]
         1440  +  }
         1441  +  set myres
         1442  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1443  +
         1444  +do_test 1.11.7.5 {
         1445  +  set myres {}
         1446  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2}] {
         1447  +    lappend myres [format %.2f [set r]]
         1448  +  }
         1449  +  set myres
         1450  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1451  +
         1452  +do_test 1.11.7.6 {
         1453  +  set myres {}
         1454  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2}] {
         1455  +    lappend myres [format %.2f [set r]]
         1456  +  }
         1457  +  set myres
         1458  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1459  +
         1460  +do_test 1.11.8.1 {
         1461  +  set myres {}
         1462  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2}] {
         1463  +    lappend myres [format %.2f [set r]]
         1464  +  }
         1465  +  set myres
         1466  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1115   1467   
  1116   1468   do_execsql_test 1.12.2.1 {
  1117   1469     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
  1118   1470   } {74   99   99   99   99   99   89   96   96   96   96   96   68   91   91   91   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   84   93   93   93   93   93   86   86   86   91   91   91   91   91   85   85   85   59   59   91   91   91   91   91   90   90   89   89   89   89   56   56   56   56   75   75   89   98   98   98   98   98   94   94   94   94   78   78   78   63   87   87   87   87   87   84   84   84   73   95   95   95   95   96   98   98   98   98   98   74   74   74   73   73   87   87   87   87   87   41   31   31   95   95   95   95   95   88   88   88   88   49   90   90   96   96   96   96   96   77   77   77   85   85   85   85   85   74   74   70   70   59   47   80   90   90   90   90   90   72   72   72   72   93   93   93   93   93   81   81   81   37   37   62   91   91   91   91   91   91   91   99   99   99   99   99   95   95   69   84   84   84   84   84   84   84   58   58   58   58   83   83   83   83   83   82   82   17   7}
  1119   1471   
  1120   1472   do_execsql_test 1.12.2.2 {
  1121   1473     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
................................................................................
  1181   1533     SELECT 
  1182   1534         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ),
  1183   1535         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ),
  1184   1536         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING )
  1185   1537       FROM t2
  1186   1538   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
  1187   1539   
  1188         -do_execsql_test 1.12.7.1 {
  1189         -  SELECT CAST( round( 100 * 
  1190         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING )
  1191         -  ) AS integer) FROM t2
  1192         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
  1193         -
  1194         -do_execsql_test 1.12.7.3 {
  1195         -  SELECT CAST( round( 100 * 
  1196         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING )
  1197         -  ) AS integer) FROM t2
  1198         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
  1199         -
  1200         -do_execsql_test 1.12.7.5 {
  1201         -  SELECT CAST( round( 100 * 
  1202         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING )
  1203         -  ) AS integer) FROM t2
  1204         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1205         -
  1206         -do_execsql_test 1.12.7.6 {
  1207         -  SELECT CAST( round( 100 * 
  1208         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING )
  1209         -  ) AS integer) FROM t2
  1210         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1540  +do_test 1.12.7.1 {
         1541  +  set myres {}
         1542  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2}] {
         1543  +    lappend myres [format %.2f [set r]]
         1544  +  }
         1545  +  set myres
         1546  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1547  +
         1548  +do_test 1.12.7.2 {
         1549  +  set myres {}
         1550  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2}] {
         1551  +    lappend myres [format %.2f [set r]]
         1552  +  }
         1553  +  set myres
         1554  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1555  +
         1556  +do_test 1.12.7.3 {
         1557  +  set myres {}
         1558  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2}] {
         1559  +    lappend myres [format %.2f [set r]]
         1560  +  }
         1561  +  set myres
         1562  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1563  +
         1564  +do_test 1.12.7.4 {
         1565  +  set myres {}
         1566  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2}] {
         1567  +    lappend myres [format %.2f [set r]]
         1568  +  }
         1569  +  set myres
         1570  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1571  +
         1572  +do_test 1.12.7.5 {
         1573  +  set myres {}
         1574  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2}] {
         1575  +    lappend myres [format %.2f [set r]]
         1576  +  }
         1577  +  set myres
         1578  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1579  +
         1580  +do_test 1.12.7.6 {
         1581  +  set myres {}
         1582  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2}] {
         1583  +    lappend myres [format %.2f [set r]]
         1584  +  }
         1585  +  set myres
         1586  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1587  +
         1588  +do_test 1.12.8.1 {
         1589  +  set myres {}
         1590  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2}] {
         1591  +    lappend myres [format %.2f [set r]]
         1592  +  }
         1593  +  set myres
         1594  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1211   1595   
  1212   1596   do_execsql_test 1.13.2.1 {
  1213   1597     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
  1214   1598   } {74   99   99   99   33   89   89   96   96   96   68   68   68   91   91   91   99   99   99   97   78   78   97   97   97   67   93   93   93   84   77   23   93   93   93   65   47   86   86   86   91   91   91   85   85   85   59   59   56   56   91   91   91   90   90   55   89   89   89   47   56   56   56   56   56   75   75   89   98   98   98   81   94   94   94   78   78   78   53   63   63   87   87   87   84   84   84   72   61   73   95   95   95   65   96   98   98   98   74   74   74   65   73   73   73   87   87   87   41   20   31   31   31   95   95   95   79   88   88   88   34   49   49   90   90   96   96   96   75   77   77   77   44   85   85   85   74   74   70   70   59   39   39   47   80   90   90   90   58   58   72   72   72   72   93   93   93   81   81   81   37   37   37   14   62   91   91   91   91   91   34   36   99   99   99   95   95   69   58   52   84   84   84   84   84   39   44   58   58   58   38   83   83   83   82   82   17   7   {}   {}}
  1215   1599   
  1216   1600   do_execsql_test 1.13.2.2 {
  1217   1601     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
................................................................................
  1277   1661     SELECT 
  1278   1662         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ),
  1279   1663         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ),
  1280   1664         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING )
  1281   1665       FROM t2
  1282   1666   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
  1283   1667   
  1284         -do_execsql_test 1.13.7.1 {
  1285         -  SELECT CAST( round( 100 * 
  1286         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING )
  1287         -  ) AS integer) FROM t2
  1288         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
  1289         -
  1290         -do_execsql_test 1.13.7.3 {
  1291         -  SELECT CAST( round( 100 * 
  1292         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING )
  1293         -  ) AS integer) FROM t2
  1294         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
  1295         -
  1296         -do_execsql_test 1.13.7.5 {
  1297         -  SELECT CAST( round( 100 * 
  1298         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING )
  1299         -  ) AS integer) FROM t2
  1300         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1301         -
  1302         -do_execsql_test 1.13.7.6 {
  1303         -  SELECT CAST( round( 100 * 
  1304         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING )
  1305         -  ) AS integer) FROM t2
  1306         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1668  +do_test 1.13.7.1 {
         1669  +  set myres {}
         1670  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2}] {
         1671  +    lappend myres [format %.2f [set r]]
         1672  +  }
         1673  +  set myres
         1674  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1675  +
         1676  +do_test 1.13.7.2 {
         1677  +  set myres {}
         1678  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2}] {
         1679  +    lappend myres [format %.2f [set r]]
         1680  +  }
         1681  +  set myres
         1682  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1683  +
         1684  +do_test 1.13.7.3 {
         1685  +  set myres {}
         1686  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2}] {
         1687  +    lappend myres [format %.2f [set r]]
         1688  +  }
         1689  +  set myres
         1690  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1691  +
         1692  +do_test 1.13.7.4 {
         1693  +  set myres {}
         1694  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2}] {
         1695  +    lappend myres [format %.2f [set r]]
         1696  +  }
         1697  +  set myres
         1698  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1699  +
         1700  +do_test 1.13.7.5 {
         1701  +  set myres {}
         1702  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2}] {
         1703  +    lappend myres [format %.2f [set r]]
         1704  +  }
         1705  +  set myres
         1706  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1707  +
         1708  +do_test 1.13.7.6 {
         1709  +  set myres {}
         1710  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2}] {
         1711  +    lappend myres [format %.2f [set r]]
         1712  +  }
         1713  +  set myres
         1714  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1715  +
         1716  +do_test 1.13.8.1 {
         1717  +  set myres {}
         1718  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2}] {
         1719  +    lappend myres [format %.2f [set r]]
         1720  +  }
         1721  +  set myres
         1722  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1307   1723   
  1308   1724   do_execsql_test 1.14.2.1 {
  1309   1725     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
  1310   1726   } {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}
  1311   1727   
  1312   1728   do_execsql_test 1.14.2.2 {
  1313   1729     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
................................................................................
  1373   1789     SELECT 
  1374   1790         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
  1375   1791         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
  1376   1792         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
  1377   1793       FROM t2
  1378   1794   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
  1379   1795   
  1380         -do_execsql_test 1.14.7.1 {
  1381         -  SELECT CAST( round( 100 * 
  1382         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
  1383         -  ) AS integer) FROM t2
  1384         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
  1385         -
  1386         -do_execsql_test 1.14.7.3 {
  1387         -  SELECT CAST( round( 100 * 
  1388         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
  1389         -  ) AS integer) FROM t2
  1390         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
  1391         -
  1392         -do_execsql_test 1.14.7.5 {
  1393         -  SELECT CAST( round( 100 * 
  1394         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
  1395         -  ) AS integer) FROM t2
  1396         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1397         -
  1398         -do_execsql_test 1.14.7.6 {
  1399         -  SELECT CAST( round( 100 * 
  1400         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
  1401         -  ) AS integer) FROM t2
  1402         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1796  +do_test 1.14.7.1 {
         1797  +  set myres {}
         1798  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1799  +    lappend myres [format %.2f [set r]]
         1800  +  }
         1801  +  set myres
         1802  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1803  +
         1804  +do_test 1.14.7.2 {
         1805  +  set myres {}
         1806  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1807  +    lappend myres [format %.2f [set r]]
         1808  +  }
         1809  +  set myres
         1810  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1811  +
         1812  +do_test 1.14.7.3 {
         1813  +  set myres {}
         1814  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1815  +    lappend myres [format %.2f [set r]]
         1816  +  }
         1817  +  set myres
         1818  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1819  +
         1820  +do_test 1.14.7.4 {
         1821  +  set myres {}
         1822  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1823  +    lappend myres [format %.2f [set r]]
         1824  +  }
         1825  +  set myres
         1826  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1827  +
         1828  +do_test 1.14.7.5 {
         1829  +  set myres {}
         1830  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1831  +    lappend myres [format %.2f [set r]]
         1832  +  }
         1833  +  set myres
         1834  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1835  +
         1836  +do_test 1.14.7.6 {
         1837  +  set myres {}
         1838  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1839  +    lappend myres [format %.2f [set r]]
         1840  +  }
         1841  +  set myres
         1842  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1843  +
         1844  +do_test 1.14.8.1 {
         1845  +  set myres {}
         1846  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1847  +    lappend myres [format %.2f [set r]]
         1848  +  }
         1849  +  set myres
         1850  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1403   1851   
  1404   1852   do_execsql_test 1.15.2.1 {
  1405   1853     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
  1406   1854   } {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83}
  1407   1855   
  1408   1856   do_execsql_test 1.15.2.2 {
  1409   1857     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
................................................................................
  1469   1917     SELECT 
  1470   1918         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ),
  1471   1919         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ),
  1472   1920         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING )
  1473   1921       FROM t2
  1474   1922   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
  1475   1923   
  1476         -do_execsql_test 1.15.7.1 {
  1477         -  SELECT CAST( round( 100 * 
  1478         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING )
  1479         -  ) AS integer) FROM t2
  1480         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
  1481         -
  1482         -do_execsql_test 1.15.7.3 {
  1483         -  SELECT CAST( round( 100 * 
  1484         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING )
  1485         -  ) AS integer) FROM t2
  1486         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
  1487         -
  1488         -do_execsql_test 1.15.7.5 {
  1489         -  SELECT CAST( round( 100 * 
  1490         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING )
  1491         -  ) AS integer) FROM t2
  1492         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1493         -
  1494         -do_execsql_test 1.15.7.6 {
  1495         -  SELECT CAST( round( 100 * 
  1496         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING )
  1497         -  ) AS integer) FROM t2
  1498         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         1924  +do_test 1.15.7.1 {
         1925  +  set myres {}
         1926  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1927  +    lappend myres [format %.2f [set r]]
         1928  +  }
         1929  +  set myres
         1930  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         1931  +
         1932  +do_test 1.15.7.2 {
         1933  +  set myres {}
         1934  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1935  +    lappend myres [format %.2f [set r]]
         1936  +  }
         1937  +  set myres
         1938  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         1939  +
         1940  +do_test 1.15.7.3 {
         1941  +  set myres {}
         1942  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1943  +    lappend myres [format %.2f [set r]]
         1944  +  }
         1945  +  set myres
         1946  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         1947  +
         1948  +do_test 1.15.7.4 {
         1949  +  set myres {}
         1950  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1951  +    lappend myres [format %.2f [set r]]
         1952  +  }
         1953  +  set myres
         1954  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         1955  +
         1956  +do_test 1.15.7.5 {
         1957  +  set myres {}
         1958  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1959  +    lappend myres [format %.2f [set r]]
         1960  +  }
         1961  +  set myres
         1962  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         1963  +
         1964  +do_test 1.15.7.6 {
         1965  +  set myres {}
         1966  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1967  +    lappend myres [format %.2f [set r]]
         1968  +  }
         1969  +  set myres
         1970  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         1971  +
         1972  +do_test 1.15.8.1 {
         1973  +  set myres {}
         1974  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         1975  +    lappend myres [format %.2f [set r]]
         1976  +  }
         1977  +  set myres
         1978  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1499   1979   
  1500   1980   do_execsql_test 1.16.2.1 {
  1501   1981     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
  1502   1982   } {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7}
  1503   1983   
  1504   1984   do_execsql_test 1.16.2.2 {
  1505   1985     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
................................................................................
  1565   2045     SELECT 
  1566   2046         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ),
  1567   2047         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ),
  1568   2048         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
  1569   2049       FROM t2
  1570   2050   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
  1571   2051   
  1572         -do_execsql_test 1.16.7.1 {
  1573         -  SELECT CAST( round( 100 * 
  1574         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
  1575         -  ) AS integer) FROM t2
  1576         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
  1577         -
  1578         -do_execsql_test 1.16.7.3 {
  1579         -  SELECT CAST( round( 100 * 
  1580         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
  1581         -  ) AS integer) FROM t2
  1582         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
  1583         -
  1584         -do_execsql_test 1.16.7.5 {
  1585         -  SELECT CAST( round( 100 * 
  1586         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
  1587         -  ) AS integer) FROM t2
  1588         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1589         -
  1590         -do_execsql_test 1.16.7.6 {
  1591         -  SELECT CAST( round( 100 * 
  1592         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING )
  1593         -  ) AS integer) FROM t2
  1594         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         2052  +do_test 1.16.7.1 {
         2053  +  set myres {}
         2054  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2055  +    lappend myres [format %.2f [set r]]
         2056  +  }
         2057  +  set myres
         2058  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         2059  +
         2060  +do_test 1.16.7.2 {
         2061  +  set myres {}
         2062  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2063  +    lappend myres [format %.2f [set r]]
         2064  +  }
         2065  +  set myres
         2066  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         2067  +
         2068  +do_test 1.16.7.3 {
         2069  +  set myres {}
         2070  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2071  +    lappend myres [format %.2f [set r]]
         2072  +  }
         2073  +  set myres
         2074  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         2075  +
         2076  +do_test 1.16.7.4 {
         2077  +  set myres {}
         2078  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2079  +    lappend myres [format %.2f [set r]]
         2080  +  }
         2081  +  set myres
         2082  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         2083  +
         2084  +do_test 1.16.7.5 {
         2085  +  set myres {}
         2086  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2087  +    lappend myres [format %.2f [set r]]
         2088  +  }
         2089  +  set myres
         2090  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
         2091  +
         2092  +do_test 1.16.7.6 {
         2093  +  set myres {}
         2094  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2095  +    lappend myres [format %.2f [set r]]
         2096  +  }
         2097  +  set myres
         2098  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
         2099  +
         2100  +do_test 1.16.8.1 {
         2101  +  set myres {}
         2102  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2103  +    lappend myres [format %.2f [set r]]
         2104  +  }
         2105  +  set myres
         2106  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1595   2107   
  1596   2108   do_execsql_test 1.17.2.1 {
  1597   2109     SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
  1598   2110   } {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7   {}   {}   {}   {}}
  1599   2111   
  1600   2112   do_execsql_test 1.17.2.2 {
  1601   2113     SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
................................................................................
  1661   2173     SELECT 
  1662   2174         row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ),
  1663   2175         rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ),
  1664   2176         dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING )
  1665   2177       FROM t2
  1666   2178   } {1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 16 2   17 16 2   18 16 2   19 16 2   20 16 2   21 16 2   22 16 2   23 16 2   24 16 2   25 16 2   26 16 2   27 16 2   28 16 2   29 16 2   30 16 2   31 16 2   32 16 2   33 33 3   34 33 3   35 33 3   36 33 3   37 33 3   38 33 3   39 33 3   40 33 3   41 33 3   42 33 3   43 33 3   44 33 3   45 33 3   46 33 3   47 33 3   48 33 3   49 33 3   50 33 3   51 33 3   52 33 3   53 33 3   54 54 4   55 54 4   56 54 4   57 54 4   58 54 4   59 54 4   60 54 4   61 54 4   62 54 4   63 54 4   64 54 4   65 54 4   66 54 4   67 54 4   68 54 4   69 54 4   70 54 4   71 54 4   72 54 4   73 54 4   74 54 4   75 54 4   76 76 5   77 76 5   78 76 5   79 76 5   80 76 5   81 76 5   82 76 5   83 76 5   84 76 5   85 76 5   86 76 5   87 76 5   88 76 5   89 76 5   90 76 5   91 76 5   1 1 1   2 1 1   3 1 1   4 1 1   5 1 1   6 1 1   7 1 1   8 1 1   9 1 1   10 1 1   11 1 1   12 1 1   13 1 1   14 1 1   15 1 1   16 1 1   17 1 1   18 1 1   19 1 1   20 1 1   21 1 1   22 1 1   23 23 2   24 23 2   25 23 2   26 23 2   27 23 2   28 23 2   29 23 2   30 23 2   31 23 2   32 23 2   33 23 2   34 23 2   35 23 2   36 23 2   37 23 2   38 23 2   39 23 2   40 23 2   41 23 2   42 23 2   43 23 2   44 23 2   45 23 2   46 46 3   47 46 3   48 46 3   49 46 3   50 46 3   51 46 3   52 46 3   53 46 3   54 46 3   55 46 3   56 46 3   57 46 3   58 46 3   59 46 3   60 46 3   61 46 3   62 46 3   63 46 3   64 46 3   65 46 3   66 46 3   67 67 4   68 67 4   69 67 4   70 67 4   71 67 4   72 67 4   73 67 4   74 67 4   75 67 4   76 67 4   77 67 4   78 67 4   79 67 4   80 67 4   81 67 4   82 67 4   83 67 4   84 67 4   85 67 4   86 67 4   87 87 5   88 87 5   89 87 5   90 87 5   91 87 5   92 87 5   93 87 5   94 87 5   95 87 5   96 87 5   97 87 5   98 87 5   99 87 5   100 87 5   101 87 5   102 87 5   103 87 5   104 87 5   105 87 5   106 87 5   107 87 5   108 87 5   109 87 5}
  1667   2179   
  1668         -do_execsql_test 1.17.7.1 {
  1669         -  SELECT CAST( round( 100 * 
  1670         -      percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING )
  1671         -  ) AS integer) FROM t2
  1672         -} {0   1   1   2   2   3   3   4   4   5   5   6   6   7   7   8   8   9   9   10   10   11   11   12   12   13   13   14   14   15   15   16   16   17   17   18   18   19   19   20   20   21   21   22   22   23   23   24   24   25   25   26   26   27   27   28   28   29   29   30   30   31   31   32   32   33   33   34   34   35   35   36   36   37   37   38   38   39   39   40   40   41   41   42   42   43   43   44   44   45   45   46   46   47   47   48   48   49   49   50   50   51   51   52   52   53   53   54   54   55   55   56   56   57   57   58   58   59   59   60   60   61   61   62   62   63   63   64   64   65   65   66   66   67   67   68   68   69   69   70   70   71   71   72   72   73   73   74   74   75   75   76   76   77   77   78   78   79   79   80   80   81   81   82   82   83   83   84   84   85   85   86   86   87   87   88   88   89   89   90   90   91   91   92   92   93   93   94   94   95   95   96   96   97   97   98   98   99   99   100}
         2180  +do_test 1.17.7.1 {
         2181  +  set myres {}
         2182  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2183  +    lappend myres [format %.2f [set r]]
         2184  +  }
         2185  +  set myres
         2186  +} {0.00 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.06 0.07 0.07 0.08 0.08 0.09 0.09 0.10 0.10 0.11 0.11 0.12 0.12 0.13 0.13 0.14 0.14 0.15 0.15 0.16 0.16 0.17 0.17 0.18 0.18 0.19 0.19 0.20 0.20 0.21 0.21 0.22 0.22 0.23 0.23 0.24 0.24 0.25 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.49 0.49 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.55 0.55 0.56 0.56 0.57 0.57 0.58 0.58 0.59 0.59 0.60 0.60 0.61 0.61 0.62 0.62 0.63 0.63 0.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 0.69 0.70 0.70 0.71 0.71 0.72 0.72 0.73 0.73 0.74 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 0.81 0.82 0.82 0.83 0.83 0.84 0.84 0.85 0.85 0.86 0.86 0.87 0.87 0.88 0.88 0.89 0.89 0.90 0.90 0.91 0.91 0.92 0.92 0.93 0.93 0.94 0.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
         2187  +
         2188  +do_test 1.17.7.2 {
         2189  +  set myres {}
         2190  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2191  +    lappend myres [format %.2f [set r]]
         2192  +  }
         2193  +  set myres
         2194  +} {0.00 0.07 0.14 0.21 0.29 0.36 0.43 0.50 0.57 0.64 0.71 0.79 0.86 0.93 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.06 0.12 0.19 0.25 0.31 0.38 0.44 0.50 0.56 0.62 0.69 0.75 0.81 0.88 0.94 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.00 0.05 0.10 0.14 0.19 0.24 0.29 0.33 0.38 0.43 0.48 0.52 0.57 0.62 0.67 0.71 0.76 0.81 0.86 0.90 0.95 1.00 0.00 0.05 0.11 0.16 0.21 0.26 0.32 0.37 0.42 0.47 0.53 0.58 0.63 0.68 0.74 0.79 0.84 0.89 0.95 1.00 0.00 0.07 0.13 0.20 0.27 0.33 0.40 0.47 0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.00 0.00 0.05 0.09 0.14 0.18 0.23 0.27 0.32 0.36 0.41 0.45 0.50 0.55 0.59 0.64 0.68 0.73 0.77 0.82 0.86 0.91 0.95 1.00}
         2195  +
         2196  +do_test 1.17.7.3 {
         2197  +  set myres {}
         2198  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2199  +    lappend myres [format %.2f [set r]]
         2200  +  }
         2201  +  set myres
         2202  +} {0.00 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.11 0.11 0.12 0.12 0.12 0.13 0.13 0.14 0.15 0.15 0.15 0.16 0.16 0.16 0.18 0.18 0.19 0.19 0.19 0.20 0.20 0.21 0.21 0.21 0.23 0.23 0.24 0.24 0.24 0.25 0.25 0.26 0.27 0.27 0.27 0.28 0.28 0.28 0.30 0.30 0.31 0.31 0.31 0.31 0.31 0.31 0.34 0.34 0.34 0.34 0.36 0.36 0.37 0.37 0.37 0.37 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.43 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.48 0.48 0.48 0.48 0.50 0.50 0.51 0.51 0.52 0.52 0.53 0.53 0.54 0.54 0.54 0.55 0.56 0.56 0.56 0.56 0.58 0.58 0.58 0.58 0.60 0.60 0.60 0.61 0.61 0.62 0.63 0.63 0.63 0.63 0.65 0.65 0.66 0.66 0.67 0.67 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.70 0.70 0.73 0.73 0.73 0.74 0.75 0.75 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.78 0.80 0.80 0.81 0.81 0.81 0.81 0.83 0.83 0.83 0.84 0.85 0.85 0.86 0.86 0.86 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.89 0.89 0.92 0.92 0.92 0.93 0.94 0.94 0.94 0.95 0.95 0.95 0.97 0.97 0.98 0.98 0.99 0.99 0.99}
         2203  +
         2204  +do_test 1.17.7.4 {
         2205  +  set myres {}
         2206  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2207  +    lappend myres [format %.2f [set r]]
         2208  +  }
         2209  +  set myres
         2210  +} {0.00 0.07 0.14 0.21 0.21 0.21 0.43 0.50 0.57 0.64 0.71 0.71 0.86 0.86 0.86 0.00 0.00 0.10 0.10 0.19 0.19 0.29 0.29 0.38 0.38 0.38 0.52 0.57 0.57 0.67 0.67 0.67 0.81 0.81 0.81 0.81 0.81 0.00 0.00 0.00 0.19 0.19 0.19 0.38 0.38 0.50 0.56 0.62 0.69 0.69 0.81 0.81 0.81 1.00 0.00 0.00 0.09 0.09 0.18 0.18 0.18 0.32 0.32 0.32 0.32 0.32 0.55 0.55 0.64 0.68 0.73 0.73 0.73 0.86 0.91 0.91 0.91 0.00 0.05 0.10 0.15 0.15 0.15 0.15 0.35 0.35 0.45 0.50 0.55 0.55 0.55 0.55 0.55 0.80 0.80 0.80 0.80 1.00 0.00 0.05 0.05 0.05 0.20 0.25 0.25 0.35 0.35 0.45 0.45 0.45 0.60 0.60 0.60 0.75 0.75 0.75 0.90 0.90 0.90 0.00 0.05 0.05 0.05 0.19 0.19 0.19 0.33 0.33 0.33 0.33 0.52 0.52 0.62 0.62 0.62 0.76 0.81 0.86 0.90 0.90 0.90 0.00 0.00 0.00 0.16 0.21 0.21 0.32 0.32 0.42 0.42 0.42 0.42 0.63 0.68 0.74 0.74 0.84 0.84 0.95 0.95 0.00 0.00 0.00 0.20 0.27 0.27 0.40 0.40 0.40 0.40 0.67 0.73 0.73 0.87 0.93 0.93 0.00 0.00 0.00 0.14 0.18 0.18 0.18 0.32 0.32 0.32 0.45 0.50 0.50 0.50 0.50 0.68 0.73 0.77 0.77 0.77 0.91 0.91 0.91}
         2211  +
         2212  +do_test 1.17.7.5 {
         2213  +  set myres {}
         2214  +  foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2215  +    lappend myres [format %.2f [set r]]
         2216  +  }
         2217  +  set myres
         2218  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.19 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.27 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.60 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.71 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.81 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89 0.89}
  1673   2219   
  1674         -do_execsql_test 1.17.7.3 {
  1675         -  SELECT CAST( round( 100 * 
  1676         -      percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING )
  1677         -  ) AS integer) FROM t2
  1678         -} {0   1   1   2   2   2   3   3   4   5   5   6   6   6   7   7   7   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   18   18   19   19   19   20   20   21   21   21   23   23   24   24   24   25   25   26   27   27   27   28   28   28   30   30   31   31   31   31   31   31   34   34   34   34   36   36   37   37   37   37   39   39   40   40   41   41   41   42   43   43   43   44   45   45   46   46   47   47   48   48   48   48   50   50   51   51   52   52   53   53   54   54   54   55   56   56   56   56   58   58   58   58   60   60   60   61   61   62   63   63   63   63   65   65   66   66   67   67   67   67   69   69   69   70   70   70   70   70   73   73   73   74   75   75   76   76   77   77   77   78   78   78   80   80   81   81   81   81   83   83   83   84   85   85   86   86   86   86   88   88   88   89   89   89   89   89   92   92   92   93   94   94   94   95   95   95   97   97   98   98   99   99   99}
         2220  +do_test 1.17.7.6 {
         2221  +  set myres {}
         2222  +  foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2223  +    lappend myres [format %.2f [set r]]
         2224  +  }
         2225  +  set myres
         2226  +} {0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.17 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.36 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.59 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.61 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80 0.80}
  1679   2227   
  1680         -do_execsql_test 1.17.7.5 {
  1681         -  SELECT CAST( round( 100 * 
  1682         -      percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING )
  1683         -  ) AS integer) FROM t2
  1684         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   19   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   27   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   39   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   49   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   60   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   71   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   81   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89   89}
  1685         -
  1686         -do_execsql_test 1.17.7.6 {
  1687         -  SELECT CAST( round( 100 * 
  1688         -      percent_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING )
  1689         -  ) AS integer) FROM t2
  1690         -} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   17   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   36   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   59   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   83   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   20   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   42   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   61   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80   80}
         2228  +do_test 1.17.8.1 {
         2229  +  set myres {}
         2230  +  foreach r [db eval {SELECT b, cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2}] {
         2231  +    lappend myres [format %.2f [set r]]
         2232  +  }
         2233  +  set myres
         2234  +} {0.00 0.01 1.00 0.01 1.00 0.01 2.00 0.03 2.00 0.03 2.00 0.03 3.00 0.04 3.00 0.04 4.00 0.04 5.00 0.05 6.00 0.06 7.00 0.07 7.00 0.07 7.00 0.07 8.00 0.09 8.00 0.09 8.00 0.09 9.00 0.10 9.00 0.10 9.00 0.10 10.00 0.10 11.00 0.12 11.00 0.12 12.00 0.13 12.00 0.13 12.00 0.13 13.00 0.14 13.00 0.14 14.00 0.14 15.00 0.16 15.00 0.16 15.00 0.16 16.00 0.17 16.00 0.17 16.00 0.17 17.00 0.18 19.00 0.18 20.00 0.19 21.00 0.20 21.00 0.20 22.00 0.21 22.00 0.21 23.00 0.23 23.00 0.23 23.00 0.23 24.00 0.23 25.00 0.23 26.00 0.25 26.00 0.25 26.00 0.25 27.00 0.26 27.00 0.26 28.00 0.27 29.00 0.28 29.00 0.28 29.00 0.28 30.00 0.29 30.00 0.29 30.00 0.29 31.00 0.30 31.00 0.30 32.00 0.31 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 33.00 0.34 34.00 0.35 34.00 0.35 34.00 0.35 34.00 0.35 35.00 0.36 35.00 0.36 36.00 0.39 36.00 0.39 36.00 0.39 36.00 0.39 37.00 0.40 37.00 0.40 38.00 0.41 38.00 0.41 39.00 0.42 39.00 0.42 39.00 0.42 40.00 0.42 41.00 0.44 41.00 0.44 41.00 0.44 42.00 0.45 43.00 0.46 43.00 0.46 44.00 0.47 44.00 0.47 46.00 0.47 46.00 0.47 47.00 0.49 47.00 0.49 47.00 0.49 47.00 0.49 49.00 0.50 50.00 0.51 51.00 0.51 52.00 0.52 53.00 0.52 54.00 0.53 55.00 0.54 55.00 0.54 56.00 0.55 56.00 0.55 56.00 0.55 57.00 0.56 58.00 0.57 58.00 0.57 58.00 0.57 58.00 0.57 59.00 0.59 59.00 0.59 59.00 0.59 59.00 0.59 60.00 0.60 61.00 0.61 61.00 0.61 62.00 0.62 62.00 0.62 63.00 0.62 64.00 0.63 65.00 0.65 65.00 0.65 65.00 0.65 66.00 0.65 67.00 0.66 68.00 0.66 69.00 0.67 70.00 0.67 72.00 0.69 72.00 0.69 72.00 0.69 73.00 0.70 73.00 0.70 73.00 0.70 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 74.00 0.72 75.00 0.74 75.00 0.74 75.00 0.74 76.00 0.74 77.00 0.76 77.00 0.76 78.00 0.77 78.00 0.77 79.00 0.77 80.00 0.78 80.00 0.78 81.00 0.80 81.00 0.80 81.00 0.80 82.00 0.80 83.00 0.81 84.00 0.82 84.00 0.82 84.00 0.82 84.00 0.82 85.00 0.84 85.00 0.84 85.00 0.84 86.00 0.84 87.00 0.85 87.00 0.85 88.00 0.86 89.00 0.88 89.00 0.88 89.00 0.88 90.00 0.89 90.00 0.89 90.00 0.89 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 91.00 0.92 93.00 0.93 93.00 0.93 93.00 0.93 94.00 0.94 95.00 0.95 95.00 0.95 95.00 0.95 96.00 0.96 96.00 0.96 96.00 0.96 97.00 0.97 97.00 0.97 98.00 0.98 98.00 0.98 99.00 1.00 99.00 1.00 99.00 1.00}
  1691   2235   
  1692   2236   finish_test