sqlite/test/window3.test

4957 lines
1.0 MiB
Plaintext
Raw Normal View History

# 2018 May 31
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
####################################################
# DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED!
####################################################
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix window3
do_execsql_test 1.0 {
DROP TABLE IF EXISTS t2;
CREATE TABLE t2(a INTEGER PRIMARY KEY, b INTEGER);
INSERT INTO t2(a, b) VALUES
(1,0), (2,74), (3,41), (4,74), (5,23), (6,99), (7,26), (8,33), (9,2),
(10,89), (11,81), (12,96), (13,59), (14,38), (15,68), (16,39), (17,62),
(18,91), (19,46), (20,6), (21,99), (22,97), (23,27), (24,46), (25,78),
(26,54), (27,97), (28,8), (29,67), (30,29), (31,93), (32,84), (33,77),
(34,23), (35,16), (36,16), (37,93), (38,65), (39,35), (40,47), (41,7),
(42,86), (43,74), (44,61), (45,91), (46,85), (47,24), (48,85), (49,43),
(50,59), (51,12), (52,32), (53,56), (54,3), (55,91), (56,22), (57,90),
(58,55), (59,15), (60,28), (61,89), (62,25), (63,47), (64,1), (65,56),
(66,40), (67,43), (68,56), (69,16), (70,75), (71,36), (72,89), (73,98),
(74,76), (75,81), (76,4), (77,94), (78,42), (79,30), (80,78), (81,33),
(82,29), (83,53), (84,63), (85,2), (86,87), (87,37), (88,80), (89,84),
(90,72), (91,41), (92,9), (93,61), (94,73), (95,95), (96,65), (97,13),
(98,58), (99,96), (100,98), (101,1), (102,21), (103,74), (104,65), (105,35),
(106,5), (107,73), (108,11), (109,51), (110,87), (111,41), (112,12), (113,8),
(114,20), (115,31), (116,31), (117,15), (118,95), (119,22), (120,73),
(121,79), (122,88), (123,34), (124,8), (125,11), (126,49), (127,34),
(128,90), (129,59), (130,96), (131,60), (132,55), (133,75), (134,77),
(135,44), (136,2), (137,7), (138,85), (139,57), (140,74), (141,29), (142,70),
(143,59), (144,19), (145,39), (146,26), (147,26), (148,47), (149,80),
(150,90), (151,36), (152,58), (153,47), (154,9), (155,72), (156,72), (157,66),
(158,33), (159,93), (160,75), (161,64), (162,81), (163,9), (164,23), (165,37),
(166,13), (167,12), (168,14), (169,62), (170,91), (171,36), (172,91),
(173,33), (174,15), (175,34), (176,36), (177,99), (178,3), (179,95), (180,69),
(181,58), (182,52), (183,30), (184,50), (185,84), (186,10), (187,84),
(188,33), (189,21), (190,39), (191,44), (192,58), (193,30), (194,38),
(195,34), (196,83), (197,27), (198,82), (199,17), (200,7);
} {}
do_execsql_test 1.1 {
SELECT max(b) OVER (
ORDER BY a
) FROM t2
} {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}
do_execsql_test 1.1.2.1 {
SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {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}
do_execsql_test 1.1.2.2 {
SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.1.3.1 {
SELECT row_number() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.1.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.1.4.1 {
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.1.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.1.4.3 {
SELECT dense_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.1.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.1.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.1.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.1.5.1 {
SELECT rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.1.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.1.5.3 {
SELECT rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.1.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.1.5.5 {
SELECT rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.1.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.1.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
FROM t2
} {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}
do_test 1.1.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.1.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.1.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.1.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.1.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.1.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.1.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.1.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.1.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.1.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.1.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.1.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.1.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.1.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.1.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.1.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.1.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.1.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.1.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
do_execsql_test 1.1.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.1.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 65 102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276}
do_execsql_test 1.1.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 196 134 109 213 223 106 234 191 212 168 229 147 218 240 65 102 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 11 87 138 63 124 179 78 141 84 120 234 79 231 162 227 228 280 57 181 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 80 182 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 111 74 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 26 51 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 48 144 207 216 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 36 121 132 88 52 232 156 210 239 250 83 103 158 210 171 198 101 163 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276}
do_execsql_test 1.1.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.1.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.1.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} 41 {} {} {} {} {} {} {} {} {} {} 26 {} {} {} {} {} {} {} 2 {} 29 {} {} {} 46 62 62 {} {} 16 {} 33 {} {} {} {} {} 78 {} 61 {} 59 77 {} 74 {} 27 {} 22 39 67 {} 54 85 74 90 7 61 90 62 {} 93 {} {} {} {} 23 {} 74 93 30 23 29 3 1 41 {} 65 33 2 98 86 89 25 76 {} 40 38 15 13 96 74 97 81 40 16 99 76 96 32 80 86 59 2 99 84 84 39 65 27 76 78 84 16 2 96 59 16 41 28 13 89 22 4 42 91 41 33 87 55 81 29 36 28 6 47 97 97 85 33 41 93 15 85 89 98 98 43 23 73 4 56 29 89 46 65 38 59 68 47 9 93 9 23 39 16 93 98 74 65 75 15 56 93 12 2 81 2 23 97 47 91 15 93 35 16 63 8 53 91 33}
do_execsql_test 1.1.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 81 {} {} {} 81 {} 21 {} {} {} {} 21 {} {} {} 21 {} {} {} {} {} {} 12 {} {} {} 12 {} {} 72 {} {} {} {} {} {} {} {} {} 23 {} {} {} {} {} {} {} {} {} {} {} 73 {} 23 {} {} {} {} {} {} {} {} 74 {} {} {} {} {} {} {} {} 64 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 15 {} {} {} {} {} {} 55 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 47 {} {} {} {} {} 27 47 {} {} {} {} {} {} {} {} {} 98 {} 98 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 29 {} {} {} {} {} {} {} 29 29 {} {} {}}
do_execsql_test 1.1.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 9 9 10 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 17 17 19 19 19 19 20 20 21 21 21 21 21 22 22 22 22 23 23 23 23 23 25 25 26 26 26 26 26 27 27 28 29 29 29 29 30 30 30 30 30 30 30 30 31 31 31 31 31 32 32 33 33 33 33 33 33 33 33 34 34 34 34 35 35 35 36 36 36 36 36 36 36 36 36 36 36 36 37 37 37 37 38 38 38 39 39 39 39 39 40 40 40 40 41 41 41 41 41 41 42 43 43 43 43 43 43 44 44 44 44 44 46 46 46 46 47 47 47 47 47 47 47 47 47 47 49 49 49}
do_execsql_test 1.1.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 1 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.1.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 90 {} {} {} 90 1 30 {} {} {} 31 30 {} {} {} 1 40 {} 50 11 81 42 40 {} 50 81 40 {} {} 50 {} 52 {} 41 81 {} 41 {} 2 30 2 81 82 53 {} 10 {} {} 81 {} 41 10 81 30 81 {} 3 3 23 {} 3 61 80 {} 94 3 91 91 72 3 63 30 91 94 94 72 91 73 91 84 84 33 41 1 33 84 73 73 91 20 41 84 33 33 84 33 41 84 21 44 22 90 22 81 81 74 93 93 93 81 21 83 44 44 21 21 21 13 21 21 34 11 34 73 74 2 60 2 34 2 34 74 60 23 2 2 2 11 91 60 62 73 74 70 51 65 74 93 65 70 34 70 93 93 93 62 35 44 43 12 35 41 43 44 44 41 80 54 72 43 41 43 91 12 80 80 35 33 12}
do_execsql_test 1.1.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.1.11.1 {
SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.1.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.1.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.1.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9}
do_execsql_test 1.1.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.1.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.2.2.1 {
SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.2.2.2 {
SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.2.3.1 {
SELECT row_number() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.2.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.2.4.1 {
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.2.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.2.4.3 {
SELECT dense_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.2.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.2.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.2.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.2.5.1 {
SELECT rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.2.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.2.5.3 {
SELECT rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.2.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.2.5.5 {
SELECT rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.2.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.2.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
FROM t2
} {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}
do_test 1.2.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.2.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.2.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.2.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.2.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.2.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.2.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.2.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.2.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.2.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.2.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.2.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.2.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.2.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.2.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.2.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.2.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.2.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.2.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
do_execsql_test 1.2.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.2.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.2.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.2.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.2.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.2.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 81 86 81 46 98 97 23 41 72 29 13 28 35 16 47 47 9 24 26 98 58 8 24 30 91 58 2 56 29 73 2 42 46 62 62 73 40 16 85 33 37 81 25 9 87 78 87 61 28 59 77 90 74 9 27 41 22 39 67 72 54 85 74 90 7 61 90 62 4 93 72 96 94 29 23 95 74 93 30 23 29 3 1 41 80 65 33 2 98 86 89 25 76 65 40 38 15 13 96 74 97 81 40 16 99 76 96 32 80 86 59 2 99 84 84 39 65 27 76 78 84 16 2 96 59 16 41 28 13 89 22 4 42 91 41 33 87 55 81 29 36 28 6 47 97 97 85 33 41 93 15 85 89 98 98 43 23 73 4 56 29 89 46 65 38 59 68 47 9 93 9 23 39 16 93 98 74 65 75 15 56 93 12 2 81 2 23 97 47 91 15 93 35 16 63 8 53 91 33}
do_execsql_test 1.2.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 81 {} {} {} 81 21 21 {} {} {} {} 21 {} {} {} 21 12 {} 72 {} {} {} 12 {} 72 {} 12 {} {} 72 {} {} {} {} {} {} {} {} {} 23 {} {} {} {} {} 73 {} {} {} {} {} 73 {} 23 {} {} {} {} {} {} {} {} 74 {} {} {} {} {} {} {} {} 64 {} {} {} {} {} {} {} {} {} {} 55 {} {} {} {} {} {} 15 55 {} {} {} {} {} 55 {} {} {} {} 16 {} 26 26 {} {} {} {} 26 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 47 {} {} {} {} {} 47 {} {} {} {} {} 27 47 {} {} {} 98 {} {} {} {} {} 98 {} 98 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 29 {} {} {} {} {} 9 {} 29 29 {} {} {}}
do_execsql_test 1.2.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 9 9 10 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 17 17 19 19 19 19 20 20 21 21 21 21 21 22 22 22 22 23 23 23 23 23 25 25 26 26 26 26 26 27 27 28 29 29 29 29 30 30 30 30 30 30 30 30 31 31 31 31 31 32 32 33 33 33 33 33 33 33 33 34 34 34 34 35 35 35 36 36 36 36 36 36 36 36 36 36 36 36 37 37 37 37 38 38 38 39 39 39 39 39 40 40 40 40 41 41 41 41 41 41 42 43 43 43 43 43 43 44 44 44 44 44 46 46 46 46 47 47 47 47 47 47 47 47 47 47 49 49 49}
do_execsql_test 1.2.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 80 {} {} {} {} {} {} {} {} {} {} {} {} {} 1 1 51 51 91 91 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 2 2 62 62 62 {} {} {} {} {} {} {} {} {} {} {} 13 13 43 43 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 74 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 35 85 85 85 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 26 66 66 66 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 37 37 37 87 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 58 58 {} {} {} {} {} {} {} {} {} {} {} {} {} 39 39 39 89 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.2.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 74 32 31 84 91 74 3 93 84 74 31 12 90 31 22 74 64 43 64 64 90 74 22 43 90 1 30 62 22 31 31 30 74 64 64 1 40 33 50 11 81 42 40 13 50 81 40 13 13 50 33 52 24 41 81 34 41 34 2 30 2 81 82 53 33 10 33 33 81 34 41 10 81 30 81 4 3 3 23 94 3 61 80 84 94 3 91 91 72 3 63 30 91 94 94 72 91 73 91 84 84 33 41 1 33 84 73 73 91 20 41 84 33 33 84 33 41 84 21 44 22 90 22 81 81 74 93 93 93 81 21 83 44 44 21 21 21 13 21 21 34 11 34 73 74 2 60 2 34 2 34 74 60 23 2 2 2 11 91 60 62 73 74 70 51 65 74 93 65 70 34 70 93 93 93 62 35 44 43 12 35 41 43 44 44 41 80 54 72 43 41 43 91 12 80 80 35 33 12}
do_execsql_test 1.2.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.2.11.1 {
SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.2.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.2.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.2.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9}
do_execsql_test 1.2.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.2.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.3.2.1 {
SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {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}
do_execsql_test 1.3.2.2 {
SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {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}
do_execsql_test 1.3.3.1 {
SELECT row_number() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.3.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.3.4.1 {
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.3.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.3.4.3 {
SELECT dense_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.3.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.3.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.3.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.3.5.1 {
SELECT rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.3.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.3.5.3 {
SELECT rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.3.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.3.5.5 {
SELECT rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.3.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.3.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW )
FROM t2
} {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}
do_test 1.3.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.3.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.3.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.3.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.3.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.3.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.3.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.3.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.3.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.3.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.3.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.3.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.3.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.3.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.3.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.3.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.3.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.3.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.3.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
do_execsql_test 1.3.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.3.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 65 102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276}
do_execsql_test 1.3.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 196 134 109 213 223 106 234 191 212 168 229 147 218 240 65 102 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 11 87 138 63 124 179 78 141 84 120 234 79 231 162 227 228 280 57 181 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 80 182 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 111 74 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 26 51 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 48 144 207 216 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 36 121 132 88 52 232 156 210 239 250 83 103 158 210 171 198 101 163 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276}
do_execsql_test 1.3.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.3.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.3.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.3.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.3.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.3.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.3.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.3.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.3.11.1 {
SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {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}
do_execsql_test 1.3.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.3.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98 98 99 99 99}
do_execsql_test 1.3.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 10 20 30 30 30 40 50 60 70 80 80 90 90 90 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 91 91 91 91 2 2 2 12 12 12 22 22 32 42 52 62 62 72 72 72 82 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 83 93 93 93 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 84 84 84 94 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 85 95 95 95 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 86 96 96 96 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 87 87 97 97 8 8 8 28 38 38 58 58 58 58 68 78 78 88 98 98 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89 89 99 99 99}
do_execsql_test 1.3.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.3.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.4.2.1 {
SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 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}
do_execsql_test 1.4.2.2 {
SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7}
do_execsql_test 1.4.3.1 {
SELECT row_number() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.4.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.4.4.1 {
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.4.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.4.4.3 {
SELECT dense_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.4.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.4.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.4.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.4.5.1 {
SELECT rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.4.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.4.5.3 {
SELECT rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.4.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.4.5.5 {
SELECT rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.4.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.4.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING )
FROM t2
} {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}
do_test 1.4.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.4.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.4.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.4.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.4.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.4.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.4.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.4.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.4.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.4.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.4.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.4.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.4.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.4.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.4.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.4.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.4.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.4.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.4.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
do_execsql_test 1.4.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.4.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.4.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.4.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.4.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.4.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 4 61 42 8 35 77 7 81 96 9 11 89 32 53 91 30 51 56 54 73 22 59 75 74 78 8 16 65 15 8 31 87 90 12 32 96 74 76 37 85 90 15 35 2 60 36 75 9 51 47 63 51 90 26 42 26 8 76 80 90 37 87 56 79 5 87 8 2 39 73 64 36 90 72 78 36 73 51 33 20 41 2 26 37 33 8 14 33 81 55 1 9 12 39 64 87 72 34 82 21 34 99 62 74 41 69 22 75 27 58 8 79 77 26 26 55 {} 29 30 7 {} 66 55 2 34 64 {} 33 {} 44 84 {} {} 95 85 19 {} 83 {} 91 {} {} 9 50 91 33 34 {} {} 84 {} 7 9 {} {} {} 44 {} {} {} {} 91 84 {} 95 95 52 {} {} {} {} {} 21 {} {} {} 58 {} {} {} {} {} {} {} 83 {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.4.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 81 {} {} {} 21 {} {} {} {} {} {} {} {} {} {} {} 12 {} 62 {} {} {} 12 {} {} {} 72 {} {} {} {} {} {} {} {} {} {} {} {} 53 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 95 {} {} {} {} {} {} 85 {} {} {} {} {} {} {} {} {} {} {} 56 {} 36 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 57 {} {} {} {} {} 7 {} {} {} {} {} {} {} {} {} {} 8 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 9 {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.4.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 2 2 3 3 5 6 7 8 8 9 9 10 11 12 12 13 13 14 15 16 16 17 19 20 21 22 23 23 24 25 26 26 27 28 29 30 31 31 33 33 33 33 34 34 35 36 36 36 37 37 38 39 39 40 41 41 42 43 44 46 47 47 47 47 49 51 52 53 54 55 56 56 57 58 58 58 59 59 59 61 61 62 63 65 65 65 67 69 70 72 72 73 74 74 74 74 75 76 77 78 80 81 81 83 84 84 84 85 85 87 87 88 89 89 90 90 90 91 91 91 93 93 95 95 96 96 97 98 99 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.4.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 80 {} {} {} {} {} {} {} {} {} {} {} {} {} 1 11 61 81 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 12 12 72 82 {} {} {} {} {} {} {} {} {} {} {} {} 13 23 63 73 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 74 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 35 85 85 95 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 26 76 86 96 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 37 47 47 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 58 68 {} {} {} {} {} {} {} {} {} {} {} {} {} 39 49 59 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.4.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 64 42 81 94 1 44 73 74 44 85 22 33 41 72 93 34 65 54 5 15 81 15 63 84 21 2 62 54 93 43 33 2 75 16 86 23 12 85 62 13 53 94 12 75 23 73 72 96 46 33 55 25 26 74 34 87 84 87 55 53 25 84 75 56 66 54 36 97 55 78 84 84 95 74 65 17 87 77 96 8 47 95 34 89 98 7 46 6 96 8 47 95 56 89 59 36 36 78 96 89 29 37 95 56 39 {} 8 58 67 85 86 {} 58 49 {} 29 76 {} 77 {} 78 56 98 36 97 {} 59 89 89 47 78 {} {} {} 38 68 58 {} 58 38 {} 98 {} {} {} 19 57 9 {} 9 {} {} 7 {} {} {} 39 89 38 78 39 {} {} 8 19 {} {} {} {} 89 {} 39 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 9 {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.4.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.4.11.1 {
SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {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}
do_execsql_test 1.4.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.4.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98 98 99 99 99}
do_execsql_test 1.4.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 10 20 30 30 30 40 50 60 70 80 80 90 90 90 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 91 91 91 91 2 2 2 12 12 12 22 22 32 42 52 62 62 72 72 72 82 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 83 93 93 93 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 84 84 84 94 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 85 95 95 95 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 86 96 96 96 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 87 87 97 97 8 8 8 28 38 38 58 58 58 58 68 78 78 88 98 98 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89 89 99 99 99}
do_execsql_test 1.4.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.4.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.5.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 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}
do_execsql_test 1.5.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.5.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.5.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.5.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.5.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.5.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.5.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.5.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.5.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.5.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.5.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.5.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.5.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.5.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.5.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.5.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING )
FROM t2
} {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}
do_test 1.5.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.5.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.5.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.5.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.5.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.5.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.5.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.5.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.5.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.5.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.5.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.5.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.5.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.5.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.5.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.5.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.5.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.5.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.5.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279}
do_execsql_test 1.5.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 1 147 106 109 168 134 218 191 212 229 240 {} {} {} {} 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 {} {} {} {} 11 79 63 84 78 120 87 162 124 141 138 227 228 {} {} {} {} 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 {} {} {} {} 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 {} {} {} {} 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 {} {} {} {} 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 {} {} {} {} 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 {} {} {} {} 52 83 103 36 88 171 158 156 198 121 210 132 {} {} {} {} 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163}
do_execsql_test 1.5.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 1 65 102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171}
do_execsql_test 1.5.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 1 196 134 109 213 223 106 234 191 212 168 {} {} {} {} 65 102 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 {} {} {} {} 11 87 138 63 124 179 78 141 84 120 234 79 231 {} {} {} {} 57 181 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 {} {} {} {} 80 182 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 {} {} {} {} 111 74 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 {} {} {} {} 26 51 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 {} {} {} {} 48 144 207 216 50 224 124 202 87 110 195 200 196 96 110 211 {} {} {} {} 36 121 132 88 52 232 156 210 239 250 83 103 {} {} {} {} 101 163 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150}
do_execsql_test 1.5.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163}
do_execsql_test 1.5.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.5.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} 41 {} {} {} {} {} {} {} {} {} {} 26 {} {} {} {} {} {} {} 2 {} {} {} {} {} 46 62 62 {} {} {} {} 33 {} {} {} {} {} 78 {} 61 {} 59 77 {} 74 {} 27 {} {} 39 67 {} 54 85 74 90 7 61 90 62 {} 93 {} {} {} {} 23 {} 74 93 {} 23 29 3 1 41 {} 65 33 2 98 86 89 25 76 {} 40 38 15 {} {} 74 97 81 40 16 99 76 96 32 80 86 59 2 99 84 84 39 65 27 76 78 84 16 2 96 59 16 41 28 13 89 22 4 42 91 41 33 87 55 81 29 36 28 6 47 97 97 85 33 41 93 15 85 89 98 98 43 23 73 4 56 29 89 46 65 38 59 68 47 9 93 9 23 39 16 93 98 74 65 75 15 56 93 12 2 81 2 23 97 47 91 15 93 35 16 63 8 53 91 33}
do_execsql_test 1.5.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 81 {} {} {} 81 {} {} {} {} {} {} 21 {} {} {} {} {} {} {} {} {} {} 12 {} {} {} 12 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 73 {} 23 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 15 {} {} {} {} {} {} 55 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 47 {} {} {} {} {} {} 47 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 29 29 {} {} {}}
do_execsql_test 1.5.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} {} {} {} 2 2 2 3 3 3 3 4 4 4 5 5 5 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 9 9 10 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 17 17 19 19 19 19 20 20 21 21 21 21 21 22 22 22 22 23 23 23 23 23 25 25 26 26 26 26 26 27 27 28 29 29 29 29 30 30 30 30 30 30 30 30 31 31 31 31 31 32 32 33 33 33 33 33 33 33 33 34 34 34 34 35 35 35 36 36 36 36 36 36 36 36 36 36 36 36 37 37 37 37 38 38 38 39 39 39 39 39 40 40 40 40 41 41 41 41 41 41 42 43 43 43 43 43 43 44 44 44 44 44 46 46 46 46 47 47 47 47 47 47 47 47 47 47 49 49 49}
do_execsql_test 1.5.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.5.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} 90 1 30 {} {} {} {} 30 {} {} {} 1 40 {} 50 11 81 {} 40 {} 50 81 40 {} {} 50 {} {} {} 41 81 {} 41 {} 2 30 2 81 82 {} {} 10 {} {} 81 {} 41 10 81 30 81 {} {} 3 23 {} 3 61 80 {} {} 3 91 91 72 3 63 30 91 94 94 72 91 73 91 84 84 33 41 1 33 84 73 73 91 20 41 84 33 33 84 33 41 84 21 44 22 90 22 81 81 74 93 93 93 81 21 83 44 44 21 21 21 13 21 21 34 11 34 73 74 2 60 2 34 2 34 74 60 23 2 2 2 11 91 60 62 73 74 70 51 65 74 93 65 70 34 70 93 93 93 62 35 44 43 12 35 41 43 44 44 41 80 54 72 43 41 43 91 12 80 80 35 33 12}
do_execsql_test 1.5.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.5.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{} {} {} {} 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.5.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{} {} {} {} 0 0 0 0 0 0 0 0 0 0 0 {} {} {} {} 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 {} {} {} {} 2 2 2 2 2 2 2 2 2 2 2 2 2 {} {} {} {} 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 {} {} {} {} 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 {} {} {} {} 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 {} {} {} {} 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 {} {} {} {} 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 {} {} {} {} 38 38 38 38 38 38 38 38 38 38 38 38 {} {} {} {} 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.5.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.5.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 0 0 0 0 0 0 0 0 0 0 0 {} {} {} {} 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 {} {} {} {} 2 2 2 2 2 2 2 2 2 2 2 2 2 {} {} {} {} 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 {} {} {} {} 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 {} {} {} {} 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 {} {} {} {} 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 {} {} {} {} 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 {} {} {} {} 8 8 8 8 8 8 8 8 8 8 8 8 {} {} {} {} 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9}
do_execsql_test 1.5.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{} {} {} {} 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.5.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 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}
do_execsql_test 1.6.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 0 0 0 41 23 23 23 26 2 2 2 81 59 38 38 38 39 39 46 6 6 6 27 27 27 46 54 8 8 8 29 29 77 23 16 16 16 16 35 35 7 7 7 61 61 61 24 24 24 43 12 12 12 3 3 3 22 22 15 15 15 25 25 1 1 1 40 40 16 16 16 36 36 76 76 4 4 4 30 30 30 29 29 29 2 2 2 37 37 72 41 9 9 9 61 65 13 13 13 58 1 1 1 21 35 5 5 5 11 11 41 12 8 8 8 20 15 15 15 22 22 73 34 8 8 8 11 34 34 59 59 55 55 55 44 2 2 2 7 57 29 29 29 19 19 19 26 26 26 47 36 36 36 9 9 9 66 33 33 33 64 64 9 9 9 13 12 12 12 14 36 36 33 15 15 15 34 3 3 3 58 52 30 30 30 10 10 10 21 21 21 39 30 30 30 34 27 27}
do_execsql_test 1.6.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.6.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.6.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.6.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.6.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.6.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.6.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.6.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.6.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.6.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.6.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.6.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.6.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.6.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.6.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING )
FROM t2
} {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}
do_test 1.6.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.6.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.6.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.6.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.6.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.6.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.6.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.6.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.6.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.6.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.6.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.6.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.6.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.6.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.6.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.6.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.6.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.6.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.6.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280}
do_execsql_test 1.6.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 1 147 106 109 168 134 218 191 212 229 240 213 234 {} {} 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 {} {} 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 {} {} 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 {} {} 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 {} {} 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 {} {} 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 {} {} 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 {} {} 52 83 103 36 88 171 158 156 198 121 210 132 210 239 {} {} 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276}
do_execsql_test 1.6.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 1 65 102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105}
do_execsql_test 1.6.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 1 196 134 109 213 223 106 234 191 212 168 229 147 {} {} 65 102 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 {} {} 11 87 138 63 124 179 78 141 84 120 234 79 231 162 227 {} {} 57 181 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 {} {} 80 182 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 {} {} 111 74 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 {} {} 26 51 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 {} {} 48 144 207 216 50 224 124 202 87 110 195 200 196 96 110 211 173 197 {} {} 36 121 132 88 52 232 156 210 239 250 83 103 158 210 {} {} 101 163 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105}
do_execsql_test 1.6.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276}
do_execsql_test 1.6.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} 26 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 89 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 53 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 77 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 81 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 22 {} {} {} 12 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} {} {} 1 2 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 81 {} {} {} {} {} {} {} {} {} {} {} 91 {} {} {} {} {} 22 {} {} {} 12 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.6.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2
} {{} {} 0 0 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}
do_execsql_test 1.6.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2
} {{} {} 0 0 0 90 40 30 80 20 90 60 70 80 90 {} {} 41 41 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 {} {} 2 2 2 62 12 32 22 42 2 72 12 22 2 72 72 {} {} 23 23 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 {} {} 74 74 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 {} {} 65 65 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 {} {} 26 26 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 {} {} 97 97 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 {} {} 38 38 38 68 78 8 28 98 78 58 98 8 88 8 {} {} 99 99 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.6.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 0 0 0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98}
do_execsql_test 1.6.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 0 0 0 10 20 30 30 30 40 50 60 70 80 {} {} 1 1 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 {} {} 2 2 2 2 2 12 12 12 22 22 32 42 52 62 62 {} {} 3 3 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 {} {} 4 4 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 {} {} 5 5 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 {} {} 6 6 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 {} {} 7 7 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 {} {} 8 8 8 8 8 28 38 38 58 58 58 58 68 78 {} {} 9 9 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89}
do_execsql_test 1.6.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
} {{} {} 0 0 0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.6.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.7.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {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}
do_execsql_test 1.7.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.7.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.7.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.7.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.7.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.7.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.7.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.7.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.7.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.7.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.7.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.7.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.7.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.7.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.7.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.7.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW )
FROM t2
} {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}
do_test 1.7.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.7.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.7.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.7.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.7.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.7.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.7.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.7.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.7.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.7.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.7.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.7.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.7.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.7.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.7.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.7.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.7.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.7.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.7.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
do_execsql_test 1.7.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.7.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 65 102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276}
do_execsql_test 1.7.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 196 134 109 213 223 106 234 191 212 168 229 147 218 240 65 102 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 11 87 138 63 124 179 78 141 84 120 234 79 231 162 227 228 280 57 181 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 80 182 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 111 74 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 26 51 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 48 144 207 216 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 36 121 132 88 52 232 156 210 239 250 83 103 158 210 171 198 101 163 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276}
do_execsql_test 1.7.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.7.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.7.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} 41 {} {} {} {} {} {} {} {} {} {} 26 {} {} {} {} {} {} {} 2 {} 29 {} {} {} 46 62 62 {} {} 16 {} 33 {} {} {} {} {} 78 {} 61 {} 59 77 {} 74 {} 27 {} 22 39 67 {} 54 85 74 90 7 61 90 62 {} 93 {} {} {} {} 23 {} 74 93 30 23 29 3 1 41 {} 65 33 2 98 86 89 25 76 {} 40 38 15 13 96 74 97 81 40 16 99 76 96 32 80 86 59 2 99 84 84 39 65 27 76 78 84 16 2 96 59 16 41 28 13 89 22 4 42 91 41 33 87 55 81 29 36 28 6 47 97 97 85 33 41 93 15 85 89 98 98 43 23 73 4 56 29 89 46 65 38 59 68 47 9 93 9 23 39 16 93 98 74 65 75 15 56 93 12 2 81 2 23 97 47 91 15 93 35 16 63 8 53 91 33}
do_execsql_test 1.7.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 81 {} {} {} 81 {} 21 {} {} {} {} 21 {} {} {} 21 {} {} {} {} {} {} 12 {} {} {} 12 {} {} 72 {} {} {} {} {} {} {} {} {} 23 {} {} {} {} {} {} {} {} {} {} {} 73 {} 23 {} {} {} {} {} {} {} {} 74 {} {} {} {} {} {} {} {} 64 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 15 {} {} {} {} {} {} 55 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 47 {} {} {} {} {} 27 47 {} {} {} {} {} {} {} {} {} 98 {} 98 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 29 {} {} {} {} {} {} {} 29 29 {} {} {}}
do_execsql_test 1.7.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 9 9 10 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 17 17 19 19 19 19 20 20 21 21 21 21 21 22 22 22 22 23 23 23 23 23 25 25 26 26 26 26 26 27 27 28 29 29 29 29 30 30 30 30 30 30 30 30 31 31 31 31 31 32 32 33 33 33 33 33 33 33 33 34 34 34 34 35 35 35 36 36 36 36 36 36 36 36 36 36 36 36 37 37 37 37 38 38 38 39 39 39 39 39 40 40 40 40 41 41 41 41 41 41 42 43 43 43 43 43 43 44 44 44 44 44 46 46 46 46 47 47 47 47 47 47 47 47 47 47 49 49 49}
do_execsql_test 1.7.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 1 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.7.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 90 {} {} {} 90 1 30 {} {} {} 31 30 {} {} {} 1 40 {} 50 11 81 42 40 {} 50 81 40 {} {} 50 {} 52 {} 41 81 {} 41 {} 2 30 2 81 82 53 {} 10 {} {} 81 {} 41 10 81 30 81 {} 3 3 23 {} 3 61 80 {} 94 3 91 91 72 3 63 30 91 94 94 72 91 73 91 84 84 33 41 1 33 84 73 73 91 20 41 84 33 33 84 33 41 84 21 44 22 90 22 81 81 74 93 93 93 81 21 83 44 44 21 21 21 13 21 21 34 11 34 73 74 2 60 2 34 2 34 74 60 23 2 2 2 11 91 60 62 73 74 70 51 65 74 93 65 70 34 70 93 93 93 62 35 44 43 12 35 41 43 44 44 41 80 54 72 43 41 43 91 12 80 80 35 33 12}
do_execsql_test 1.7.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.7.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.7.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.7.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.7.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9}
do_execsql_test 1.7.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.7.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.8.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {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}
do_execsql_test 1.8.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 23 23 23 2 2 2 2 2 38 38 38 38 38 39 6 6 6 6 6 27 27 27 8 8 8 8 8 29 23 16 16 16 16 16 16 7 7 7 7 7 61 24 24 24 24 12 12 12 3 3 3 3 3 15 15 15 15 15 1 1 1 1 1 16 16 16 16 16 36 36 4 4 4 4 4 30 29 29 29 2 2 2 2 2 37 37 9 9 9 9 9 13 13 13 13 1 1 1 1 1 5 5 5 5 5 11 11 8 8 8 8 8 15 15 15 15 22 22 8 8 8 8 8 11 34 34 55 55 55 44 2 2 2 2 2 7 29 29 19 19 19 19 19 26 26 26 36 36 9 9 9 9 9 33 33 33 33 9 9 9 9 9 12 12 12 12 14 33 15 15 15 15 3 3 3 3 3 30 30 30 10 10 10 10 10 21 21 21 30 30 30 27 27 17 7}
do_execsql_test 1.8.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.8.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.8.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.8.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.8.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.8.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.8.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.8.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.8.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.8.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.8.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.8.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.8.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.8.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.8.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW )
FROM t2
} {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}
do_test 1.8.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.8.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.8.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.8.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.8.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.8.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.8.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.8.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.8.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.8.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.8.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.8.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.8.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.8.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.8.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.8.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.8.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.8.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.8.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
do_execsql_test 1.8.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.8.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 65 102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276}
do_execsql_test 1.8.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 196 134 109 213 223 106 234 191 212 168 229 147 218 240 65 102 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 11 87 138 63 124 179 78 141 84 120 234 79 231 162 227 228 280 57 181 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 80 182 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 111 74 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 26 51 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 48 144 207 216 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 36 121 132 88 52 232 156 210 239 250 83 103 158 210 171 198 101 163 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276}
do_execsql_test 1.8.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.8.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.8.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} 26 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 56 {} {} {} {} {} {} {} {} {} 89 {} {} {} {} {} {} {} {} {} {} {} 4 {} {} {} {} {} {} {} {} 53 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 77 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.8.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 81 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 22 {} {} {} 12 {} {} {} {} {} {} {} {} {} {} {} {} 43 {} {} {} {} {} {} {} {} {} {} {} {} {} 33 {} {} {} {} {} {} {} {} 4 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.8.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {0 1 1 1 1 2 2 3 4 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.8.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 1 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.8.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 81 {} {} {} {} {} {} {} {} {} {} {} 91 {} {} {} {} {} 22 {} {} {} 12 {} {} {} {} {} {} {} {} {} {} {} {} 43 {} {} {} {} {} {} {} {} {} {} {} {} {} 33 {} {} {} {} {} {} {} {} 4 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.8.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.8.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2
} {0 0 0 0 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}
do_execsql_test 1.8.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2
} {0 0 0 0 0 90 40 30 80 20 90 60 70 80 90 41 41 41 41 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 2 2 2 2 2 62 12 32 22 42 2 72 12 22 2 72 72 23 23 23 23 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 74 74 74 74 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 65 65 65 65 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 26 26 26 26 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 97 97 97 97 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 38 38 38 38 38 68 78 8 28 98 78 58 98 8 88 8 99 99 99 99 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.8.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98}
do_execsql_test 1.8.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 10 20 30 30 30 40 50 60 70 80 1 1 1 1 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 2 2 2 2 2 2 2 12 12 12 22 22 32 42 52 62 62 3 3 3 3 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 4 4 4 4 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 5 5 5 5 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 6 6 6 6 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 7 7 7 7 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 8 8 8 8 8 8 8 28 38 38 58 58 58 58 68 78 9 9 9 9 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89}
do_execsql_test 1.8.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
} {0 0 0 0 0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.8.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.9.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {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}
do_execsql_test 1.9.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {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}
do_execsql_test 1.9.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.9.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.9.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.9.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.9.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.9.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.9.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.9.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.9.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.9.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.9.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.9.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.9.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.9.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.9.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW )
FROM t2
} {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}
do_test 1.9.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.9.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.9.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.9.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.9.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.9.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.9.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.9.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.9.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.9.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.9.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.9.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.9.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.9.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.9.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.9.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.9.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.9.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.9.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
do_execsql_test 1.9.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.9.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 65 102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276}
do_execsql_test 1.9.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 196 134 109 213 223 106 234 191 212 168 229 147 218 240 65 102 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 11 87 138 63 124 179 78 141 84 120 234 79 231 162 227 228 280 57 181 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 80 182 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 111 74 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 26 51 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 48 144 207 216 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 36 121 132 88 52 232 156 210 239 250 83 103 158 210 171 198 101 163 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276}
do_execsql_test 1.9.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {1 147 106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229}
do_execsql_test 1.9.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.9.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.9.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.9.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.9.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.9.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.9.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.9.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {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}
do_execsql_test 1.9.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.9.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98 98 99 99 99}
do_execsql_test 1.9.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 10 20 30 30 30 40 50 60 70 80 80 90 90 90 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 91 91 91 91 2 2 2 12 12 12 22 22 32 42 52 62 62 72 72 72 82 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 83 93 93 93 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 84 84 84 94 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 85 95 95 95 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 86 96 96 96 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 87 87 97 97 8 8 8 28 38 38 58 58 58 58 68 78 78 88 98 98 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89 89 99 99 99}
do_execsql_test 1.9.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.9.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.10.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {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}
do_execsql_test 1.10.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.10.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.10.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.10.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.10.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.10.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.10.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.10.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.10.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.10.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.10.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.10.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.10.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.10.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.10.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.10.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING )
FROM t2
} {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}
do_test 1.10.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.10.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.10.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.10.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.10.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.10.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.10.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.10.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.10.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.10.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.10.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.10.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.10.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.10.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.10.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.10.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.10.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.10.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.10.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207 207 207}
do_execsql_test 1.10.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {168 134 218 191 212 229 240 213 234 196 223 223 223 223 223 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 210 210 210 210 78 120 87 162 124 141 138 227 228 179 231 234 280 280 280 280 280 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 279 279 279 279 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 229 229 229 229 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 274 274 274 274 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 212 212 212 212 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 207 207 207 207 88 171 158 156 198 121 210 132 210 239 250 232 232 232 232 232 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229 229 229}
do_execsql_test 1.10.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276 276 276 276 276}
do_execsql_test 1.10.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {213 223 106 234 191 212 168 229 147 218 240 240 240 240 240 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 263 263 263 263 124 179 78 141 84 120 234 79 231 162 227 228 280 280 280 280 280 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 252 252 252 252 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 171 171 171 171 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 274 274 274 274 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 226 226 226 226 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 124 124 124 124 52 232 156 210 239 250 83 103 158 210 171 198 198 198 198 198 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276 276 276 276 276}
do_execsql_test 1.10.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229 229 229}
do_execsql_test 1.10.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.10.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} 41 {} {} {} {} {} {} {} {} {} {} 26 {} {} {} {} {} {} {} 2 {} 29 {} {} {} 46 62 62 {} {} 16 {} 33 {} {} {} {} {} 78 {} 61 {} 59 77 90 74 {} 27 {} 22 39 67 {} 54 85 74 90 7 61 90 62 {} 93 {} {} 94 {} 23 {} 74 93 30 23 29 3 1 41 80 65 33 2 98 86 89 25 76 65 40 38 15 13 96 74 97 81 40 16 99 76 96 32 80 86 59 2 99 84 84 39 65 27 76 78 84 16 2 96 59 16 41 28 13 89 22 4 42 91 41 33 87 55 81 29 36 28 6 47 97 97 85 33 41 93 15 85 89 98 98 43 23 73 4 56 29 89 46 65 38 59 68 47 9 93 9 23 39 16 93 98 74 65 75 15 56 93 12 2 81 2 23 97 47 91 15 93 35 16 63 8 53 91 33}
do_execsql_test 1.10.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 81 {} {} {} 81 {} 21 {} {} {} {} 21 {} {} {} 21 12 {} {} {} {} {} 12 {} 72 {} 12 {} {} 72 {} {} {} {} {} {} {} {} {} 23 {} {} {} {} {} 73 {} {} {} {} {} 73 {} 23 {} {} {} {} {} {} {} {} 74 {} {} {} {} {} {} {} {} 64 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 15 55 {} {} {} {} {} 55 {} {} {} {} 16 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 47 {} {} {} {} {} 47 {} {} {} {} {} 27 47 {} {} {} {} {} {} {} {} {} 98 {} 98 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 29 {} {} {} {} {} 9 {} 29 29 {} {} {}}
do_execsql_test 1.10.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 9 9 10 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 17 17 19 19 19 19 20 20 21 21 21 21 21 22 22 22 22 23 23 23 23 23 25 25 26 26 26 26 26 27 27 28 29 29 29 29 30 30 30 30 30 30 30 30 31 31 31 31 31 32 32 33 33 33 33 33 33 33 33 34 34 34 34 35 35 35 36 36 36 36 36 36 36 36 36 36 36 36 37 37 37 37 38 38 38 39 39 39 39 39 40 40 40 40 41 41 41 41 41 41 42 43 43 43 43 43 43 44 44 44 44 44 46 46 46 46 47 47 47 47 47 47 47 47 47 47 49 49 49}
do_execsql_test 1.10.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 1 1 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 2 2 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 13 13 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.10.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 90 {} {} {} 90 1 30 {} {} 31 31 30 {} {} {} 1 40 {} 50 11 81 42 40 {} 50 81 40 {} {} 50 {} 52 {} 41 81 {} 41 {} 2 30 2 81 82 53 {} 10 {} {} 81 {} 41 10 81 30 81 {} 3 3 23 94 3 61 80 {} 94 3 91 91 72 3 63 30 91 94 94 72 91 73 91 84 84 33 41 1 33 84 73 73 91 20 41 84 33 33 84 33 41 84 21 44 22 90 22 81 81 74 93 93 93 81 21 83 44 44 21 21 21 13 21 21 34 11 34 73 74 2 60 2 34 2 34 74 60 23 2 2 2 11 91 60 62 73 74 70 51 65 74 93 65 70 34 70 93 93 93 62 35 44 43 12 35 41 43 44 44 41 80 54 72 43 41 43 91 12 80 80 35 33 12}
do_execsql_test 1.10.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.10.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.10.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.10.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.10.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9}
do_execsql_test 1.10.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.10.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.11.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {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}
do_execsql_test 1.11.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {0 0 0 0 0 23 2 2 2 2 2 2 2 38 38 38 38 6 6 6 6 6 6 6 27 8 8 8 8 8 8 8 16 16 16 16 16 16 7 7 7 7 7 7 7 24 24 24 12 12 12 3 3 3 3 3 3 3 15 15 15 1 1 1 1 1 1 1 16 16 16 16 16 4 4 4 4 4 4 4 29 29 2 2 2 2 2 2 2 9 9 9 9 9 9 9 13 13 1 1 1 1 1 1 1 5 5 5 5 5 8 8 8 8 8 8 8 15 15 15 15 8 8 8 8 8 8 8 11 34 34 55 44 2 2 2 2 2 2 2 7 19 19 19 19 19 19 19 26 26 26 9 9 9 9 9 9 9 33 33 9 9 9 9 9 9 9 12 12 12 12 14 15 15 15 3 3 3 3 3 3 3 30 10 10 10 10 10 10 10 21 21 21 30 27 27 17 7 7 7}
do_execsql_test 1.11.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.11.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.11.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.11.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.11.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.11.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.11.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.11.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.11.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.11.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.11.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.11.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.11.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.11.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.11.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING )
FROM t2
} {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}
do_test 1.11.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.11.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.11.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.11.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.11.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.11.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.11.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.11.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.11.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.11.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.11.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.11.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.11.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.11.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.11.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.11.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.11.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.11.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.11.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207}
do_execsql_test 1.11.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {106 109 168 134 218 191 212 229 240 213 234 196 223 223 223 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 210 210 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 280 280 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 279 279 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 229 229 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 274 274 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 212 212 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 207 207 103 36 88 171 158 156 198 121 210 132 210 239 250 232 232 232 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229}
do_execsql_test 1.11.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {102 11 87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276 276 276}
do_execsql_test 1.11.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {134 109 213 223 106 234 191 212 168 229 147 218 240 240 240 119 136 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 263 263 138 63 124 179 78 141 84 120 234 79 231 162 227 228 280 280 280 110 179 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 252 252 71 157 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 171 171 132 189 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 274 274 52 85 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 226 226 207 216 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 124 124 132 88 52 232 156 210 239 250 83 103 158 210 171 198 198 198 172 163 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276 276 276}
do_execsql_test 1.11.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {106 109 168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229}
do_execsql_test 1.11.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.11.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} 26 {} {} {} {} {} {} {} {} {} {} 97 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 56 {} {} {} {} {} {} {} {} {} 89 {} {} {} {} {} {} {} {} {} {} {} 4 {} {} {} {} {} {} {} {} 53 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 {} {} {} {} 73 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 77 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.11.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 81 {} {} {} {} {} {} {} {} {} {} {} 12 {} {} {} {} {} 22 {} {} {} 12 {} {} {} {} {} {} {} {} {} {} {} {} 43 {} {} {} {} {} {} {} {} {} {} {} {} {} 33 {} {} {} {} {} {} {} {} 4 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 15 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.11.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {0 1 1 1 1 2 2 3 4 6 7 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.11.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 1 1 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 2 2 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 13 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.11.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 81 {} {} {} {} {} {} {} {} {} {} {} 91 {} {} {} {} {} 22 {} {} {} 12 {} {} {} {} {} {} {} {} {} {} {} {} 43 {} {} {} {} {} {} {} {} {} {} {} {} {} 33 {} {} {} {} {} {} {} {} 4 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 15 {} {} {} {} {} {} {} {} {} {} {} 16 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.11.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.11.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2
} {0 0 0 0 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}
do_execsql_test 1.11.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2
} {0 0 0 0 0 90 40 30 80 20 90 60 70 80 90 41 41 41 41 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 2 2 2 2 2 62 12 32 22 42 2 72 12 22 2 72 72 23 23 23 23 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 74 74 74 74 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 65 65 65 65 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 26 26 26 26 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 97 97 97 97 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 38 38 38 38 38 68 78 8 28 98 78 58 98 8 88 8 99 99 99 99 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.11.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {0 0 0 0 0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98}
do_execsql_test 1.11.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {0 0 0 0 0 10 20 30 30 30 40 50 60 70 80 1 1 1 1 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 2 2 2 2 2 2 2 12 12 12 22 22 32 42 52 62 62 3 3 3 3 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 4 4 4 4 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 5 5 5 5 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 6 6 6 6 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 7 7 7 7 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 8 8 8 8 8 8 8 28 38 38 58 58 58 58 68 78 9 9 9 9 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89}
do_execsql_test 1.11.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
} {0 0 0 0 0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.11.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.12.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {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}
do_execsql_test 1.12.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {0 23 23 23 2 2 2 2 2 38 38 38 38 38 39 6 6 6 6 6 27 27 27 8 8 8 8 8 29 23 16 16 16 16 16 16 7 7 7 7 7 61 24 24 24 24 12 12 12 3 3 3 3 3 15 15 15 15 15 1 1 1 1 1 16 16 16 16 16 36 36 4 4 4 4 4 30 29 29 29 2 2 2 2 2 37 37 9 9 9 9 9 13 13 13 13 1 1 1 1 1 5 5 5 5 5 11 11 8 8 8 8 8 15 15 15 15 22 22 8 8 8 8 8 11 34 34 55 55 55 44 2 2 2 2 2 7 29 29 19 19 19 19 19 26 26 26 36 36 9 9 9 9 9 33 33 33 33 9 9 9 9 9 12 12 12 12 14 33 15 15 15 15 3 3 3 3 3 30 30 30 10 10 10 10 10 21 21 21 30 30 30 27 27 17 7 7 7 7 7}
do_execsql_test 1.12.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.12.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.12.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.12.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.12.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.12.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.12.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.12.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.12.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.12.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.12.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.12.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.12.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.12.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.12.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING )
FROM t2
} {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}
do_test 1.12.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.12.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.12.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.12.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.12.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.12.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.12.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.12.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.12.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.12.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.12.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.12.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.12.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.12.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.12.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.12.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.12.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.12.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.12.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207 207 207}
do_execsql_test 1.12.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {168 134 218 191 212 229 240 213 234 196 223 223 223 223 223 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 210 210 210 210 78 120 87 162 124 141 138 227 228 179 231 234 280 280 280 280 280 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 279 279 279 279 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 229 229 229 229 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 274 274 274 274 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 212 212 212 212 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 207 207 207 207 88 171 158 156 198 121 210 132 210 239 250 232 232 232 232 232 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229 229 229}
do_execsql_test 1.12.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276 276 276 276 276}
do_execsql_test 1.12.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {213 223 106 234 191 212 168 229 147 218 240 240 240 240 240 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 263 263 263 263 124 179 78 141 84 120 234 79 231 162 227 228 280 280 280 280 280 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 252 252 252 252 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 171 171 171 171 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 274 274 274 274 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 226 226 226 226 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 124 124 124 124 52 232 156 210 239 250 83 103 158 210 171 198 198 198 198 198 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276 276 276 276 276}
do_execsql_test 1.12.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229 229 229}
do_execsql_test 1.12.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.12.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} 81 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} {} {} 56 {} {} {} {} {} {} {} {} {} {} {} 78 {} {} {} {} {} {} {} {} 37 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 21 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 85 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.12.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 81 {} {} {} 21 {} {} {} {} {} {} {} {} {} {} {} 12 {} {} {} {} {} 12 {} {} {} 72 {} {} {} {} {} {} {} {} {} {} {} {} 53 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.12.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {0 1 2 2 3 3 5 6 7 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.12.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 1 11 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 12 12 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 13 23 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.12.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 81 {} {} {} 21 {} {} {} {} {} {} {} {} {} {} {} 12 {} {} {} {} {} 12 {} {} {} 72 {} {} {} {} {} {} {} {} {} {} {} {} 53 {} {} {} {} {} {} {} {} {} {} {} {} {} 74 {} {} {} {} {} {} {} {} 34 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.12.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.12.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2
} {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}
do_execsql_test 1.12.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.12.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98 98 99 99 99}
do_execsql_test 1.12.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {0 10 20 30 30 30 40 50 60 70 80 80 90 90 90 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 91 91 91 91 2 2 2 12 12 12 22 22 32 42 52 62 62 72 72 72 82 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 83 93 93 93 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 84 84 84 94 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 85 95 95 95 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 86 96 96 96 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 87 87 97 97 8 8 8 28 38 38 58 58 58 58 68 78 78 88 98 98 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89 89 99 99 99}
do_execsql_test 1.12.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.12.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.13.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {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 {} {}}
do_execsql_test 1.13.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {23 23 23 26 2 2 2 81 59 38 38 38 39 39 46 6 6 6 27 27 27 46 54 8 8 8 29 29 77 23 16 16 16 16 35 35 7 7 7 61 61 61 24 24 24 43 12 12 12 3 3 3 22 22 15 15 15 25 25 1 1 1 40 40 16 16 16 36 36 76 76 4 4 4 30 30 30 29 29 29 2 2 2 37 37 72 41 9 9 9 61 65 13 13 13 58 1 1 1 21 35 5 5 5 11 11 41 12 8 8 8 20 15 15 15 22 22 73 34 8 8 8 11 34 34 59 59 55 55 55 44 2 2 2 7 57 29 29 29 19 19 19 26 26 26 47 36 36 36 9 9 9 66 33 33 33 64 64 9 9 9 13 12 12 12 14 36 36 33 15 15 15 34 3 3 3 58 52 30 30 30 10 10 10 21 21 21 39 30 30 30 34 27 27 17 7 7 7 {} {}}
do_execsql_test 1.13.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.13.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.13.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.13.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.13.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.13.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.13.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.13.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.13.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.13.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.13.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.13.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.13.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.13.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.13.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING )
FROM t2
} {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}
do_test 1.13.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.13.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.13.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.13.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.13.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.13.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.13.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.13.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.13.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.13.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.13.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.13.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.13.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.13.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.13.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.13.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.13.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.13.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.13.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207 {} {}}
do_execsql_test 1.13.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {168 134 218 191 212 229 240 213 234 196 223 223 223 {} {} 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 210 210 {} {} 78 120 87 162 124 141 138 227 228 179 231 234 280 280 280 {} {} 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 279 279 {} {} 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 229 229 {} {} 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 274 274 {} {} 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 212 212 {} {} 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 207 207 {} {} 88 171 158 156 198 121 210 132 210 239 250 232 232 232 {} {} 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229 {} {}}
do_execsql_test 1.13.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {87 138 57 181 80 111 26 48 144 207 36 121 132 101 163 172 196 119 136 63 124 179 110 179 182 74 132 189 51 52 85 216 163 134 123 210 78 141 28 57 187 71 87 33 172 173 50 224 88 59 111 170 109 213 223 146 147 84 41 114 191 206 221 157 161 209 229 74 140 107 187 207 212 124 202 52 232 55 184 229 106 44 132 152 120 92 110 179 235 65 70 87 110 195 200 175 234 160 234 136 80 113 187 109 121 124 196 156 210 239 250 72 109 188 202 191 105 154 79 231 147 225 103 161 169 223 96 83 249 212 162 227 228 167 180 193 76 78 117 177 214 145 208 235 150 110 211 103 158 200 168 229 92 156 243 280 279 116 173 269 271 131 133 223 128 173 197 210 99 150 161 147 218 240 109 136 146 261 263 124 130 252 171 190 213 274 108 195 226 119 124 171 198 105 120 276 276 276 {} {}}
do_execsql_test 1.13.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {213 223 106 234 191 212 168 229 147 218 240 240 240 {} {} 123 210 146 147 44 132 152 160 105 154 92 156 243 109 136 146 261 263 263 263 {} {} 124 179 78 141 84 120 234 79 231 162 227 228 280 280 280 {} {} 28 57 187 41 114 191 206 221 92 110 136 147 167 180 193 279 124 130 252 252 252 {} {} 161 209 229 179 235 80 225 76 78 117 177 214 116 173 269 271 171 171 171 {} {} 87 74 140 113 187 103 161 169 145 208 235 131 133 223 190 213 274 274 274 {} {} 33 172 173 107 187 207 212 65 70 109 121 124 223 150 128 108 195 226 226 226 {} {} 50 224 124 202 87 110 195 200 196 96 110 211 173 197 119 124 124 124 {} {} 52 232 156 210 239 250 83 103 158 210 171 198 198 198 {} {} 59 111 170 55 184 229 175 72 109 188 202 249 200 99 150 161 105 120 276 276 276 {} {}}
do_execsql_test 1.13.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {168 134 218 191 212 229 240 213 234 196 223 44 92 109 105 136 146 65 156 132 154 102 123 119 160 152 146 147 136 243 261 263 210 11 79 63 84 78 120 87 162 124 141 138 227 228 179 231 234 280 28 41 124 57 130 92 57 110 114 136 147 167 110 180 193 191 252 187 179 206 181 221 279 76 78 80 116 117 71 80 171 173 177 157 161 179 214 225 182 209 269 271 235 229 103 74 131 133 113 74 87 145 190 161 169 140 111 132 213 187 208 223 235 189 274 33 108 65 26 70 51 52 128 109 121 124 85 107 150 195 226 172 173 187 223 207 212 119 50 124 96 110 87 48 110 173 124 197 211 144 196 195 200 202 224 216 207 52 83 103 36 88 171 158 156 198 121 210 132 210 239 250 232 105 99 72 55 120 59 109 150 161 111 101 200 175 188 170 202 163 184 163 172 276 249 229 229 229 {} {}}
do_execsql_test 1.13.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.13.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2
} {41 {} {} {} {} {} {} {} 59 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 43 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 84 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 65 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 74 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.13.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2
} {40 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 51 {} {} {} {} {} {} {} {} {} {} {} 22 {} {} {} {} {} 2 {} {} {} 62 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.13.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 2 3 4 5 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.13.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {20 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 11 21 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 12 12 22 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.13.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {40 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 51 {} {} {} {} {} {} {} {} {} {} {} 22 {} {} {} {} {} 2 {} {} {} 62 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.13.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.13.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2
} {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 {} {}}
do_execsql_test 1.13.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2
} {40 30 80 20 90 60 70 80 90 30 50 10 30 {} {} 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 {} {} 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 {} {} 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 {} {} 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 {} {} 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 {} {} 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 {} {} 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 {} {} 78 8 28 98 78 58 98 8 88 8 58 58 58 38 {} {} 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39 {} {}}
do_execsql_test 1.13.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98 98 99 99 99 {} {}}
do_execsql_test 1.13.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {20 30 30 30 40 50 60 70 80 80 90 90 90 {} {} 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 91 91 91 91 {} {} 2 12 12 12 22 22 32 42 52 62 62 72 72 72 82 {} {} 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 83 93 93 93 {} {} 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 84 84 84 94 {} {} 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 85 95 95 95 {} {} 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 86 96 96 96 {} {} 7 17 27 27 37 37 47 47 47 47 57 67 77 77 87 87 97 97 {} {} 8 28 38 38 58 58 58 58 68 78 78 88 98 98 {} {} 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89 89 99 99 99 {} {}}
do_execsql_test 1.13.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
} {40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39 {} {}}
do_execsql_test 1.13.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.14.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.14.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.14.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.14.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.14.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.14.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.14.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.14.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.14.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.14.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.14.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.14.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.14.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.14.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.14.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.14.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.14.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING )
FROM t2
} {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}
do_test 1.14.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.14.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.14.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.14.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.14.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.14.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.14.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.14.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.14.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.14.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.14.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.14.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.14.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.14.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.14.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.14.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.14.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.14.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.14.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
do_execsql_test 1.14.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.14.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.14.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.14.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.14.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.14.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 81 86 81 46 98 97 23 41 72 29 13 28 35 16 47 47 9 24 26 98 58 8 24 30 91 58 2 56 29 73 2 42 46 62 62 73 40 16 85 33 37 81 25 9 87 78 87 61 28 59 77 90 74 9 27 41 22 39 67 72 54 85 74 90 7 61 90 62 4 93 72 96 94 29 23 95 74 93 30 23 29 3 1 41 80 65 33 2 98 86 89 25 76 65 40 38 15 13 96 74 97 81 40 16 99 76 96 32 80 86 59 2 99 84 84 39 65 27 76 78 84 16 2 96 59 16 41 28 13 89 22 4 42 91 41 33 87 55 81 29 36 28 6 47 97 97 85 33 41 93 15 85 89 98 98 43 23 73 4 56 29 89 46 65 38 59 68 47 9 93 9 23 39 16 93 98 74 65 75 15 56 93 12 2 81 2 23 97 47 91 15 93 35 16 63 8 53 91 33}
do_execsql_test 1.14.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} 90 {} {} {} {} {} {} {} 81 {} {} {} 81 21 21 {} {} {} {} 21 {} {} {} 21 12 {} 72 {} {} {} 12 {} 72 {} 12 {} {} 72 {} {} {} {} {} {} {} {} {} 23 {} {} {} {} {} 73 {} {} {} {} {} 73 {} 23 {} {} {} {} {} {} {} {} 74 {} {} {} {} {} {} {} {} 64 {} {} {} {} {} {} {} {} {} {} 55 {} {} {} {} {} {} 15 55 {} {} {} {} {} 55 {} {} {} {} 16 {} 26 26 {} {} {} {} 26 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 47 {} {} {} {} {} 47 {} {} {} {} {} 27 47 {} {} {} 98 {} {} {} {} {} 98 {} 98 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 29 {} {} {} {} {} 9 {} 29 29 {} {} {}}
do_execsql_test 1.14.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 9 9 10 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 17 17 19 19 19 19 20 20 21 21 21 21 21 22 22 22 22 23 23 23 23 23 25 25 26 26 26 26 26 27 27 28 29 29 29 29 30 30 30 30 30 30 30 30 31 31 31 31 31 32 32 33 33 33 33 33 33 33 33 34 34 34 34 35 35 35 36 36 36 36 36 36 36 36 36 36 36 36 37 37 37 37 38 38 38 39 39 39 39 39 40 40 40 40 41 41 41 41 41 41 42 43 43 43 43 43 43 44 44 44 44 44 46 46 46 46 47 47 47 47 47 47 47 47 47 47 49 49 49}
do_execsql_test 1.14.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 80 {} {} {} {} {} {} {} {} {} {} {} {} {} 1 1 51 51 91 91 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 2 2 62 62 62 {} {} {} {} {} {} {} {} {} {} {} 13 13 43 43 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 74 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 35 85 85 85 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 26 66 66 66 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 37 37 37 87 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 58 58 {} {} {} {} {} {} {} {} {} {} {} {} {} 39 39 39 89 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.14.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 74 32 31 84 91 74 3 93 84 74 31 12 90 31 22 74 64 43 64 64 90 74 22 43 90 1 30 62 22 31 31 30 74 64 64 1 40 33 50 11 81 42 40 13 50 81 40 13 13 50 33 52 24 41 81 34 41 34 2 30 2 81 82 53 33 10 33 33 81 34 41 10 81 30 81 4 3 3 23 94 3 61 80 84 94 3 91 91 72 3 63 30 91 94 94 72 91 73 91 84 84 33 41 1 33 84 73 73 91 20 41 84 33 33 84 33 41 84 21 44 22 90 22 81 81 74 93 93 93 81 21 83 44 44 21 21 21 13 21 21 34 11 34 73 74 2 60 2 34 2 34 74 60 23 2 2 2 11 91 60 62 73 74 70 51 65 74 93 65 70 34 70 93 93 93 62 35 44 43 12 35 41 43 44 44 41 80 54 72 43 41 43 91 12 80 80 35 33 12}
do_execsql_test 1.14.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.14.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.14.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99}
do_execsql_test 1.14.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.14.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9}
do_execsql_test 1.14.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
do_execsql_test 1.14.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.15.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 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}
do_execsql_test 1.15.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7}
do_execsql_test 1.15.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.15.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.15.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.15.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.15.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.15.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.15.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.15.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.15.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.15.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.15.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.15.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.15.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.15.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.15.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING )
FROM t2
} {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}
do_test 1.15.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.15.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.15.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.15.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.15.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.15.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.15.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.15.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.15.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.15.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.15.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.15.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.15.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.15.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.15.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.15.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.15.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.15.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.15.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
do_execsql_test 1.15.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.15.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.15.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.15.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.15.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.15.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 81 86 81 46 1 67 93 26 95 80 65 56 85 30 12 81 35 89 97 31 31 85 40 96 4 73 84 9 91 73 12 5 56 24 85 49 96 75 53 61 8 8 1 55 34 43 59 80 35 15 78 35 56 70 76 59 51 75 63 26 53 5 89 15 21 5 73 33 29 74 66 12 26 58 4 12 31 35 9 87 73 55 59 53 62 73 23 62 33 90 13 90 9 10 66 5 58 44 38 58 22 33 37 2 73 36 31 72 30 47 73 15 96 70 59 90 {} 7 21 83 {} 47 90 55 36 66 {} 50 {} 84 30 {} {} 34 77 74 {} 58 {} 13 {} 82 93 69 14 62 44 {} {} 30 {} 83 93 {} {} {} 84 {} {} {} {} 14 30 82 34 34 3 {} {} {} {} {} 84 {} {} {} 99 {} {} {} {} {} {} {} 58 {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.15.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 61 {} {} {} 81 {} 91 {} {} {} {} {} {} {} {} {} 12 {} 72 {} {} {} 22 {} 82 {} 12 {} {} {} {} {} {} {} {} {} {} {} {} 43 {} {} {} {} {} 33 {} {} {} {} {} {} {} 33 {} {} {} {} {} {} {} {} 4 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 75 {} {} {} {} {} {} 15 {} {} {} {} {} {} {} {} {} {} {} 16 {} 26 36 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 37 {} {} {} {} {} 47 {} {} {} {} {} {} {} {} {} {} 98 {} {} {} {} {} 58 {} 38 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 59 {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.15.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 1 1 1 2 2 3 4 6 7 8 8 8 9 9 10 11 12 12 13 14 15 15 16 16 17 19 21 22 22 23 23 24 25 26 27 29 29 30 30 31 32 33 33 33 34 34 34 35 36 36 36 37 38 38 39 39 40 41 41 43 44 44 46 46 47 47 47 49 50 52 53 55 55 56 56 57 58 58 58 59 59 59 61 62 62 63 65 65 66 68 69 72 72 73 73 74 74 74 75 76 77 78 80 81 81 82 83 84 84 85 85 85 86 87 88 89 89 90 90 91 91 91 93 93 95 95 95 96 97 98 99 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.15.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 80 {} {} {} {} {} {} {} {} {} {} {} {} {} 1 1 51 51 91 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 2 2 62 62 72 {} {} {} {} {} {} {} {} {} {} {} 13 13 43 43 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 74 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 35 85 85 85 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 26 66 66 66 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 37 37 37 87 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 58 58 {} {} {} {} {} {} {} {} {} {} {} {} {} 39 39 39 89 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.15.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 74 32 31 84 1 14 53 3 84 44 2 93 91 32 52 34 25 33 95 65 61 35 3 74 81 2 91 33 13 23 93 12 5 46 6 82 91 44 2 73 43 84 22 95 82 63 12 75 15 93 35 85 36 33 94 77 83 7 65 43 85 64 95 46 96 33 26 36 65 17 74 74 55 33 25 47 7 47 56 7 87 55 4 58 28 47 15 95 56 7 87 55 46 58 58 26 56 17 16 99 29 7 75 16 38 99 58 98 36 15 6 {} 8 89 9 9 56 {} 97 {} 78 16 28 26 36 {} 59 39 99 27 78 {} {} {} 37 27 98 {} 88 8 {} 28 {} {} {} 49 37 29 {} 59 {} {} 47 {} 69 39 59 99 8 78 9 {} {} 58 49 {} {} {} {} 58 {} 38 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 59 {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.15.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.15.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 0 0 0 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}
do_execsql_test 1.15.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 0 0 0 0 90 40 30 80 20 90 60 70 80 90 41 41 41 41 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 2 2 2 2 2 62 12 32 22 42 2 72 12 22 2 72 72 23 23 23 23 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 74 74 74 74 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 65 65 65 65 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 26 26 26 26 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 97 97 97 97 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 38 38 38 38 38 68 78 8 28 98 78 58 98 8 88 8 99 99 99 99 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.15.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98}
do_execsql_test 1.15.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 10 20 30 30 30 40 50 60 70 80 1 1 1 1 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 2 2 2 2 2 2 2 12 12 12 22 22 32 42 52 62 62 3 3 3 3 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 4 4 4 4 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 5 5 5 5 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 6 6 6 6 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 7 7 7 7 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 8 8 8 8 8 8 8 28 38 38 58 58 58 58 68 78 9 9 9 9 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89}
do_execsql_test 1.15.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0 0 0 0 0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9}
do_execsql_test 1.15.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.16.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 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}
do_execsql_test 1.16.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7}
do_execsql_test 1.16.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.16.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.16.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.16.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.16.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.16.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.16.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.16.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.16.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.16.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.16.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.16.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.16.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.16.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.16.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING )
FROM t2
} {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}
do_test 1.16.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.16.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.16.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.16.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.16.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.16.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.16.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.16.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.16.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.16.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.16.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.16.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.16.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.16.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.16.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.16.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.16.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.16.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.16.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
do_execsql_test 1.16.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.16.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.16.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 280 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 198 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276}
do_execsql_test 1.16.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229}
do_execsql_test 1.16.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {1 76 78 33 11 108 52 83 79 65 26 70 103 80 36 116 51 52 128 117 71 63 84 109 78 147 88 121 106 124 85 107 171 150 80 171 120 109 158 87 168 173 162 156 195 198 177 124 121 134 141 210 157 132 161 218 226 191 179 138 214 212 172 173 229 240 187 210 227 228 223 225 179 182 231 207 209 212 239 234 213 234 269 196 271 235 250 223 232 229 280 44 28 105 41 99 92 72 55 109 120 119 50 124 96 59 124 110 57 130 103 74 87 48 105 136 131 133 92 109 57 146 113 74 150 87 110 65 110 145 161 156 114 111 136 147 173 124 132 101 154 167 190 161 110 102 123 169 140 111 180 119 160 197 152 146 147 132 213 193 200 136 175 188 187 208 211 144 223 196 170 202 163 184 195 200 163 191 252 235 243 172 187 202 179 261 263 206 189 276 181 274 249 221 210 229 279 224 216 207}
do_execsql_test 1.16.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 4 61 42 8 35 77 7 81 96 9 11 89 32 53 91 30 51 56 54 73 22 59 75 74 78 8 16 65 15 8 31 87 90 12 32 96 74 76 37 85 90 15 35 2 60 36 75 9 51 47 63 51 90 26 42 26 8 76 80 90 37 87 56 79 5 87 8 2 39 73 64 36 90 72 78 36 73 51 33 20 41 2 26 37 33 8 14 33 81 55 1 9 12 39 64 87 72 34 82 21 34 99 62 74 41 69 22 75 27 58 8 79 77 26 26 55 {} 29 30 7 {} 66 55 2 34 64 {} 33 {} 44 84 {} {} 95 85 19 {} 83 {} 91 {} {} 9 50 91 33 34 {} {} 84 {} 7 9 {} {} {} 44 {} {} {} {} 91 84 {} 95 95 52 {} {} {} {} {} 21 {} {} {} 58 {} {} {} {} {} {} {} 83 {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.16.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 81 {} {} {} 21 {} {} {} {} {} {} {} {} {} {} {} 12 {} 62 {} {} {} 12 {} {} {} 72 {} {} {} {} {} {} {} {} {} {} {} {} 53 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 95 {} {} {} {} {} {} 85 {} {} {} {} {} {} {} {} {} {} {} 56 {} 36 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 57 {} {} {} {} {} 7 {} {} {} {} {} {} {} {} {} {} 8 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 9 {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.16.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 2 2 3 3 5 6 7 8 8 9 9 10 11 12 12 13 13 14 15 16 16 17 19 20 21 22 23 23 24 25 26 26 27 28 29 30 31 31 33 33 33 33 34 34 35 36 36 36 37 37 38 39 39 40 41 41 42 43 44 46 47 47 47 47 49 51 52 53 54 55 56 56 57 58 58 58 59 59 59 61 61 62 63 65 65 65 67 69 70 72 72 73 74 74 74 74 75 76 77 78 80 81 81 83 84 84 84 85 85 87 87 88 89 89 90 90 90 91 91 91 93 93 95 95 96 96 97 98 99 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.16.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 80 {} {} {} {} {} {} {} {} {} {} {} {} {} 1 11 61 81 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 2 12 12 72 82 {} {} {} {} {} {} {} {} {} {} {} {} 13 23 63 73 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 34 74 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 35 85 85 95 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 26 76 86 96 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 37 47 47 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 58 58 68 {} {} {} {} {} {} {} {} {} {} {} {} {} 39 49 59 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.16.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 64 42 81 94 1 44 73 74 44 85 22 33 41 72 93 34 65 54 5 15 81 15 63 84 21 2 62 54 93 43 33 2 75 16 86 23 12 85 62 13 53 94 12 75 23 73 72 96 46 33 55 25 26 74 34 87 84 87 55 53 25 84 75 56 66 54 36 97 55 78 84 84 95 74 65 17 87 77 96 8 47 95 34 89 98 7 46 6 96 8 47 95 56 89 59 36 36 78 96 89 29 37 95 56 39 {} 8 58 67 85 86 {} 58 49 {} 29 76 {} 77 {} 78 56 98 36 97 {} 59 89 89 47 78 {} {} {} 38 68 58 {} 58 38 {} 98 {} {} {} 19 57 9 {} 9 {} {} 7 {} {} {} 39 89 38 78 39 {} {} 8 19 {} {} {} {} 89 {} 39 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 9 {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.16.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.16.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {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}
do_execsql_test 1.16.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.16.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 1 1 2 2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98 98 99 99 99}
do_execsql_test 1.16.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 10 20 30 30 30 40 50 60 70 80 80 90 90 90 1 1 11 11 21 21 31 31 41 41 41 51 61 61 81 81 81 91 91 91 91 91 2 2 2 12 12 12 22 22 32 42 52 62 62 72 72 72 82 3 3 13 13 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 83 93 93 93 4 14 24 34 34 34 34 44 44 54 64 74 74 74 74 74 84 84 84 84 94 5 15 15 15 25 35 35 55 55 65 65 65 75 75 75 85 85 85 95 95 95 6 16 16 16 26 26 26 36 36 36 36 46 46 56 56 56 66 76 86 96 96 96 7 7 7 17 27 27 37 37 47 47 47 47 57 67 77 77 87 87 97 97 8 8 8 28 38 38 58 58 58 58 68 78 78 88 98 98 9 9 9 19 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89 89 99 99 99}
do_execsql_test 1.16.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
} {0 90 40 30 80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39}
do_execsql_test 1.16.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t2
} {0 74 74 26 2 96 38 68 62 46 6 46 78 54 8 84 16 16 86 74 24 12 32 56 22 90 28 56 40 56 16 36 98 76 4 94 42 30 78 2 80 84 72 58 96 98 74 12 8 20 22 88 34 8 34 90 96 60 44 2 74 70 26 26 80 90 36 58 72 72 66 64 12 14 62 36 34 36 58 52 30 50 84 10 84 44 58 30 38 34 82 41 23 99 33 89 81 59 39 91 99 97 27 97 67 29 93 77 23 93 65 35 47 7 61 91 85 85 43 59 3 91 55 15 89 25 47 1 43 75 89 81 33 29 53 63 87 37 41 9 61 73 95 65 13 1 21 65 35 5 73 11 51 87 41 31 31 15 95 73 79 11 49 59 55 75 77 7 85 57 29 59 19 39 47 47 9 33 93 75 81 9 23 37 13 91 91 33 15 99 3 95 69 33 21 39 83 27 17 7}
do_execsql_test 1.17.2.1 {
SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 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 {} {} {} {}}
do_execsql_test 1.17.2.2 {
SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 {} {} {} {}}
do_execsql_test 1.17.3.1 {
SELECT row_number() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.17.3.2 {
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.17.4.1 {
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.17.4.2 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.17.4.3 {
SELECT dense_rank() OVER ( ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 3 3 3 4 4 5 6 7 8 8 8 9 9 9 10 10 10 11 12 12 13 13 13 14 14 15 16 16 16 17 17 17 18 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 45 45 46 46 46 46 47 48 49 50 51 52 53 53 54 54 54 55 56 56 56 56 57 57 57 57 58 59 59 60 60 61 62 63 63 63 64 65 66 67 68 69 69 69 70 70 70 71 71 71 71 71 72 72 72 73 74 74 75 75 76 77 77 78 78 78 79 80 81 81 81 81 82 82 82 83 84 84 85 86 86 86 87 87 87 88 88 88 88 88 89 89 89 90 91 91 91 92 92 92 93 93 94 94 95 95 95}
do_execsql_test 1.17.4.4 {
SELECT dense_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 5 6 7 8 9 9 10 10 10 1 1 2 2 3 3 4 4 5 5 5 6 7 7 8 8 8 9 9 9 9 9 1 1 1 2 2 2 3 3 4 5 6 7 7 8 8 8 9 1 1 2 2 3 3 3 4 4 4 4 4 5 5 6 7 8 8 8 9 10 10 10 1 2 3 4 4 4 4 5 5 6 7 8 8 8 8 8 9 9 9 9 10 1 2 2 2 3 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 1 2 2 2 3 3 3 4 4 4 4 5 5 6 6 6 7 8 9 10 10 10 1 1 1 2 3 3 4 4 5 5 5 5 6 7 8 8 9 9 10 10 1 1 1 2 3 3 4 4 4 4 5 6 6 7 8 8 1 1 1 2 3 3 3 4 4 4 5 6 6 6 6 7 8 9 9 9 10 10 10}
do_execsql_test 1.17.4.5 {
SELECT dense_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10}
do_execsql_test 1.17.4.6 {
SELECT dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}
do_execsql_test 1.17.5.1 {
SELECT rank() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
do_execsql_test 1.17.5.2 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
do_execsql_test 1.17.5.3 {
SELECT rank() OVER ( ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 2 4 4 4 7 7 9 10 11 12 12 12 15 15 15 18 18 18 21 22 22 24 24 24 27 27 29 30 30 30 33 33 33 36 37 38 39 39 41 41 43 43 43 46 47 48 48 48 51 51 53 54 54 54 57 57 57 60 60 62 63 63 63 63 63 68 68 68 68 72 72 74 74 74 74 78 78 80 80 82 82 82 85 86 86 86 89 90 90 92 92 94 94 96 96 96 96 100 101 102 103 104 105 106 106 108 108 108 111 112 112 112 112 116 116 116 116 120 121 121 123 123 125 126 127 127 127 130 131 132 133 134 135 135 135 138 138 138 141 141 141 141 141 146 146 146 149 150 150 152 152 154 155 155 157 157 157 160 161 162 162 162 162 166 166 166 169 170 170 172 173 173 173 176 176 176 179 179 179 179 179 184 184 184 187 188 188 188 191 191 191 194 194 196 196 198 198 198}
do_execsql_test 1.17.5.4 {
SELECT rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 2 3 4 4 4 7 8 9 10 11 11 13 13 13 1 1 3 3 5 5 7 7 9 9 9 12 13 13 15 15 15 18 18 18 18 18 1 1 1 4 4 4 7 7 9 10 11 12 12 14 14 14 17 1 1 3 3 5 5 5 8 8 8 8 8 13 13 15 16 17 17 17 20 21 21 21 1 2 3 4 4 4 4 8 8 10 11 12 12 12 12 12 17 17 17 17 21 1 2 2 2 5 6 6 8 8 10 10 10 13 13 13 16 16 16 19 19 19 1 2 2 2 5 5 5 8 8 8 8 12 12 14 14 14 17 18 19 20 20 20 1 1 1 4 5 5 7 7 9 9 9 9 13 14 15 15 17 17 19 19 1 1 1 4 5 5 7 7 7 7 11 12 12 14 15 15 1 1 1 4 5 5 5 8 8 8 11 12 12 12 12 16 17 18 18 18 21 21 21}
do_execsql_test 1.17.5.5 {
SELECT rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 142 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178}
do_execsql_test 1.17.5.6 {
SELECT rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87}
do_execsql_test 1.17.6.1 {
SELECT
row_number() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ),
rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ),
dense_rank() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING )
FROM t2
} {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}
do_test 1.17.7.1 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.17.7.2 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.17.7.3 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.17.7.4 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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}
do_test 1.17.7.5 {
set myres {}
foreach r [db eval {SELECT percent_rank() OVER ( ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.17.7.6 {
set myres {}
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}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.00 0.00 0.00 0.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}
do_test 1.17.8.1 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.10 0.10 0.11 0.12 0.12 0.12 0.13 0.14 0.14 0.14 0.15 0.15 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.20 0.21 0.21 0.22 0.23 0.23 0.23 0.24 0.24 0.25 0.26 0.26 0.27 0.27 0.28 0.28 0.28 0.29 0.29 0.30 0.30 0.31 0.32 0.32 0.33 0.33 0.34 0.34 0.34 0.35 0.35 0.36 0.36 0.37 0.38 0.38 0.39 0.39 0.40 0.40 0.41 0.41 0.41 0.42 0.42 0.43 0.43 0.44 0.45 0.45 0.46 0.46 0.47 0.47 0.47 0.48 0.48 0.49 0.49 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.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.64 0.64 0.65 0.65 0.66 0.66 0.67 0.67 0.68 0.68 0.69 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.76 0.76 0.77 0.77 0.78 0.78 0.79 0.79 0.80 0.80 0.81 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.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.94 0.95 0.95 0.96 0.96 0.97 0.97 0.98 0.98 0.99 0.99 1.00}
do_test 1.17.8.2 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {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.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.06 0.12 0.18 0.24 0.29 0.35 0.41 0.47 0.53 0.59 0.65 0.71 0.76 0.82 0.88 0.94 1.00 0.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.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.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.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.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.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.04 0.09 0.13 0.17 0.22 0.26 0.30 0.35 0.39 0.43 0.48 0.52 0.57 0.61 0.65 0.70 0.74 0.78 0.83 0.87 0.91 0.96 1.00}
do_test 1.17.8.3 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.01 0.01 0.01 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.07 0.07 0.07 0.09 0.09 0.09 0.10 0.10 0.10 0.10 0.12 0.12 0.13 0.13 0.13 0.14 0.14 0.14 0.16 0.16 0.16 0.17 0.17 0.17 0.18 0.18 0.19 0.20 0.20 0.21 0.21 0.23 0.23 0.23 0.23 0.23 0.25 0.25 0.25 0.26 0.26 0.27 0.28 0.28 0.28 0.29 0.29 0.29 0.30 0.30 0.31 0.34 0.34 0.34 0.34 0.34 0.35 0.35 0.35 0.35 0.36 0.36 0.39 0.39 0.39 0.39 0.40 0.40 0.41 0.41 0.42 0.42 0.42 0.42 0.44 0.44 0.44 0.45 0.46 0.46 0.47 0.47 0.47 0.47 0.49 0.49 0.49 0.49 0.50 0.51 0.51 0.52 0.52 0.53 0.54 0.54 0.55 0.55 0.55 0.56 0.57 0.57 0.57 0.57 0.59 0.59 0.59 0.59 0.60 0.61 0.61 0.62 0.62 0.62 0.63 0.65 0.65 0.65 0.65 0.66 0.66 0.67 0.67 0.69 0.69 0.69 0.70 0.70 0.70 0.72 0.72 0.72 0.72 0.72 0.74 0.74 0.74 0.74 0.76 0.76 0.77 0.77 0.77 0.78 0.78 0.80 0.80 0.80 0.80 0.81 0.82 0.82 0.82 0.82 0.84 0.84 0.84 0.84 0.85 0.85 0.86 0.88 0.88 0.88 0.89 0.89 0.89 0.92 0.92 0.92 0.92 0.92 0.93 0.93 0.93 0.94 0.95 0.95 0.95 0.96 0.96 0.96 0.97 0.97 0.98 0.98 1.00 1.00 1.00}
do_test 1.17.8.4 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%10 ORDER BY b ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.13 0.20 0.40 0.40 0.40 0.47 0.53 0.60 0.67 0.80 0.80 1.00 1.00 1.00 0.09 0.09 0.18 0.18 0.27 0.27 0.36 0.36 0.50 0.50 0.50 0.55 0.64 0.64 0.77 0.77 0.77 1.00 1.00 1.00 1.00 1.00 0.18 0.18 0.18 0.35 0.35 0.35 0.47 0.47 0.53 0.59 0.65 0.76 0.76 0.94 0.94 0.94 1.00 0.09 0.09 0.17 0.17 0.30 0.30 0.30 0.52 0.52 0.52 0.52 0.52 0.61 0.61 0.65 0.70 0.83 0.83 0.83 0.87 1.00 1.00 1.00 0.05 0.10 0.14 0.33 0.33 0.33 0.33 0.43 0.43 0.48 0.52 0.76 0.76 0.76 0.76 0.76 0.95 0.95 0.95 0.95 1.00 0.05 0.19 0.19 0.19 0.24 0.33 0.33 0.43 0.43 0.57 0.57 0.57 0.71 0.71 0.71 0.86 0.86 0.86 1.00 1.00 1.00 0.05 0.18 0.18 0.18 0.32 0.32 0.32 0.50 0.50 0.50 0.50 0.59 0.59 0.73 0.73 0.73 0.77 0.82 0.86 1.00 1.00 1.00 0.15 0.15 0.15 0.20 0.30 0.30 0.40 0.40 0.60 0.60 0.60 0.60 0.65 0.70 0.80 0.80 0.90 0.90 1.00 1.00 0.19 0.19 0.19 0.25 0.38 0.38 0.62 0.62 0.62 0.62 0.69 0.81 0.81 0.88 1.00 1.00 0.13 0.13 0.13 0.17 0.30 0.30 0.30 0.43 0.43 0.43 0.48 0.65 0.65 0.65 0.65 0.70 0.74 0.87 0.87 0.87 1.00 1.00 1.00}
do_test 1.17.8.5 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 0.18 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.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.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.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 0.70 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.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 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.17.8.6 {
set myres {}
foreach r [db eval {SELECT cume_dist() OVER ( PARTITION BY b%2 ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.58 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 0.82 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.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.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 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.61 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 0.79 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_test 1.17.8.1 {
set myres {}
foreach r [db eval {SELECT ntile(100) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 99.00 100.00 100.00}
do_test 1.17.8.2 {
set myres {}
foreach r [db eval {SELECT ntile(101) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.17.8.3 {
set myres {}
foreach r [db eval {SELECT ntile(102) OVER ( ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 97.00 98.00 98.00 99.00 100.00 101.00 102.00}
do_test 1.17.8.4 {
set myres {}
foreach r [db eval {SELECT ntile(103) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00}
do_test 1.17.8.5 {
set myres {}
foreach r [db eval {SELECT ntile(104) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00}
do_test 1.17.8.6 {
set myres {}
foreach r [db eval {SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2}] {
lappend myres [format %.2f [set r]]
}
set myres
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
do_execsql_test 1.17.9.1 {
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 {} {} {} {}}
do_execsql_test 1.17.9.2 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {223 223 223 223 223 223 223 223 223 223 223 {} {} {} {} 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 {} {} {} {} 280 280 280 280 280 280 280 280 280 280 280 280 280 {} {} {} {} 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 279 {} {} {} {} 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 {} {} {} {} 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 {} {} {} {} 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 {} {} {} {} 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 {} {} {} {} 232 232 232 232 232 232 232 232 232 232 232 232 {} {} {} {} 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 {} {} {} {}}
do_execsql_test 1.17.9.3 {
SELECT last_value(a+b) OVER ( ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 {} {} {} {}}
do_execsql_test 1.17.9.4 {
SELECT last_value(a+b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {240 240 240 240 240 240 240 240 240 240 240 {} {} {} {} 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 263 {} {} {} {} 280 280 280 280 280 280 280 280 280 280 280 280 280 {} {} {} {} 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 {} {} {} {} 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 171 {} {} {} {} 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 {} {} {} {} 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 226 {} {} {} {} 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 124 {} {} {} {} 198 198 198 198 198 198 198 198 198 198 198 198 {} {} {} {} 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 {} {} {} {}}
do_execsql_test 1.17.9.5 {
SELECT last_value(a+b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 {} {} {} {}}
do_execsql_test 1.17.9.6 {
SELECT last_value(a+b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.17.10.1 {
SELECT nth_value(b,b+1) OVER (ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2
} {23 78 85 29 84 51 93 91 68 74 65 12 4 22 37 15 53 8 16 29 8 34 3 76 73 63 90 47 98 47 90 73 20 89 91 22 77 73 42 41 32 55 79 51 74 44 81 7 65 8 43 80 8 89 90 29 36 15 42 9 9 41 20 16 11 87 20 90 84 80 41 37 34 9 75 63 34 8 8 81 95 31 74 36 41 99 90 91 99 13 2 35 33 36 38 37 20 75 17 {} 5 34 58 33 19 31 50 34 23 {} 72 90 11 85 90 36 2 {} 39 27 {} {} 64 2 74 95 37 {} 58 {} 34 44 {} {} 30 70 47 {} 7 {} 15 {} {} 12 33 36 99 17 {} {} 44 {} {} 12 {} {} {} 34 {} {} {} {} 36 44 {} 30 30 10 {} {} {} {} {} 30 {} {} {} 84 {} {} {} {} {} {} {} 7 {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.17.10.2 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2
} {80 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 21 {} {} {} 31 {} {} {} {} {} {} {} {} {} {} {} 2 {} {} {} {} {} 72 {} {} {} 82 {} {} {} {} {} {} {} {} {} {} {} {} 73 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 64 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 76 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 27 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 38 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.17.10.3 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {2 3 3 5 6 7 7 8 8 9 10 11 12 12 13 13 14 15 15 16 16 19 20 21 22 22 23 23 25 26 26 27 28 29 29 30 31 32 33 33 33 34 34 34 35 36 36 37 37 38 39 39 40 41 41 42 43 44 44 46 47 47 49 50 51 52 53 55 55 56 56 57 58 58 58 59 59 59 60 61 62 63 64 65 65 67 68 69 72 72 73 73 74 74 74 75 75 76 77 78 80 81 81 83 84 84 85 85 86 87 88 89 89 90 90 91 91 91 91 93 93 94 95 95 96 97 98 98 99 99 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.17.10.4 {
SELECT nth_value(b,b+1) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {30 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 21 31 91 91 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 22 22 32 {} {} {} {} {} {} {} {} {} {} {} {} {} {} 33 33 83 93 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 44 84 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 65 95 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 36 96 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 47 57 67 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} 78 88 98 {} {} {} {} {} {} {} {} {} {} {} {} {} 59 59 69 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.17.10.5 {
SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {80 84 22 2 34 41 85 23 24 34 25 12 13 11 72 3 85 95 4 75 85 21 65 73 44 31 62 42 4 3 73 13 2 95 56 16 43 2 25 33 83 73 34 72 96 43 13 82 16 16 13 15 65 36 74 14 7 94 47 95 73 65 35 96 36 27 4 67 77 95 78 65 44 5 74 95 78 47 47 36 58 17 5 64 29 58 8 16 86 36 58 17 5 36 29 59 67 26 78 66 49 59 38 6 96 89 {} 38 99 47 26 16 {} 8 19 {} 9 26 {} 87 {} 88 76 58 67 77 {} 9 79 49 37 88 {} {} {} 28 98 99 {} 59 39 {} 58 {} {} {} 99 27 39 {} 29 {} {} 8 {} {} {} 69 49 39 88 {} {} {} 38 99 {} {} {} {} 29 {} 89 {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.17.10.6 {
SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
do_execsql_test 1.17.11.1 {
SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2
} {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 {} {} {} {}}
do_execsql_test 1.17.11.2 {
SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2
} {80 20 90 60 70 80 90 30 50 10 30 {} {} {} {} 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 {} {} {} {} 22 42 2 72 12 22 2 72 72 12 62 52 82 {} {} {} {} 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 {} {} {} {} 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 {} {} {} {} 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 {} {} {} {} 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 {} {} {} {} 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 {} {} {} {} 28 98 78 58 98 8 88 8 58 58 58 38 {} {} {} {} 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39 {} {} {} {}}
do_execsql_test 1.17.11.3 {
SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {2 2 3 3 4 5 6 7 7 7 8 8 8 9 9 9 10 11 11 12 12 12 13 13 14 15 15 15 16 16 16 17 19 20 21 21 22 22 23 23 23 24 25 26 26 26 27 27 28 29 29 29 30 30 30 31 31 32 33 33 33 33 33 34 34 34 34 35 35 36 36 36 36 37 37 38 38 39 39 39 40 41 41 41 42 43 43 44 44 46 46 47 47 47 47 49 50 51 52 53 54 55 55 56 56 56 57 58 58 58 58 59 59 59 59 60 61 61 62 62 63 64 65 65 65 66 67 68 69 70 72 72 72 73 73 73 74 74 74 74 74 75 75 75 76 77 77 78 78 79 80 80 81 81 81 82 83 84 84 84 84 85 85 85 86 87 87 88 89 89 89 90 90 90 91 91 91 91 91 93 93 93 94 95 95 95 96 96 96 97 97 98 98 99 99 99 {} {} {} {}}
do_execsql_test 1.17.11.4 {
SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {30 30 40 50 60 70 80 80 90 90 90 {} {} {} {} 21 21 31 31 41 41 41 51 61 61 81 81 81 91 91 91 91 91 {} {} {} {} 12 12 22 22 32 42 52 62 62 72 72 72 82 {} {} {} {} 23 23 23 33 33 33 33 33 43 43 53 63 73 73 73 83 93 93 93 {} {} {} {} 34 34 34 44 44 54 64 74 74 74 74 74 84 84 84 84 94 {} {} {} {} 25 35 35 55 55 65 65 65 75 75 75 85 85 85 95 95 95 {} {} {} {} 26 26 26 36 36 36 36 46 46 56 56 56 66 76 86 96 96 96 {} {} {} {} 27 27 37 37 47 47 47 47 57 67 77 77 87 87 97 97 {} {} {} {} 38 38 58 58 58 58 68 78 78 88 98 98 {} {} {} {} 29 29 29 39 39 39 49 59 59 59 59 69 79 89 89 89 99 99 99 {} {} {} {}}
do_execsql_test 1.17.11.5 {
SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
} {80 20 90 60 70 80 90 30 50 10 30 41 81 91 61 91 91 1 81 41 61 1 21 11 51 41 31 31 11 81 91 91 21 2 62 12 32 22 42 2 72 12 22 2 72 72 12 62 52 82 23 33 93 23 93 43 3 43 33 53 63 73 13 73 73 33 93 23 13 33 3 33 83 74 74 54 84 74 24 4 94 84 74 34 34 44 74 64 14 34 84 84 44 34 65 35 85 85 55 15 25 75 95 65 65 35 5 15 95 55 75 85 75 15 95 26 96 46 6 46 16 16 86 56 56 56 16 36 76 96 96 26 26 36 66 36 36 97 27 97 67 77 47 7 47 87 37 87 77 7 57 47 47 37 27 17 7 38 68 78 8 28 98 78 58 98 8 88 8 58 58 58 38 99 89 59 39 99 29 59 89 89 29 9 79 49 59 29 59 19 39 9 9 99 69 39 {} {} {} {}}
do_execsql_test 1.17.11.6 {
SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING) FROM t2
} {{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
finish_test