File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -1086,3 +1086,35 @@ and 0.1 following)
1086
1086
1.220 2
1087
1087
3.330 1
1088
1088
drop table t1;
1089
+ #
1090
+ # RANGE-type frames and NULL values
1091
+ #
1092
+ create table t1 (
1093
+ pk int,
1094
+ a int,
1095
+ b int
1096
+ );
1097
+ insert into t1 values (1, NULL,1);
1098
+ insert into t1 values (2, NULL,1);
1099
+ insert into t1 values (3, NULL,1);
1100
+ insert into t1 values (4, 10 ,1);
1101
+ insert into t1 values (5, 11 ,1);
1102
+ insert into t1 values (6, 12 ,1);
1103
+ insert into t1 values (7, 13 ,1);
1104
+ insert into t1 values (8, 14 ,1);
1105
+ select
1106
+ pk, a,
1107
+ count(b) over (order by a
1108
+ range between 2 preceding
1109
+ and 2 following) as CNT
1110
+ from t1;
1111
+ pk a CNT
1112
+ 1 NULL 3
1113
+ 2 NULL 3
1114
+ 3 NULL 3
1115
+ 4 10 3
1116
+ 5 11 4
1117
+ 6 12 5
1118
+ 7 13 4
1119
+ 8 14 3
1120
+ drop table t1;
Original file line number Diff line number Diff line change @@ -637,3 +637,30 @@ select
637
637
from t1;
638
638
639
639
drop table t1;
640
+
641
+ --echo #
642
+ --echo # RANGE-type frames and NULL values
643
+ --echo #
644
+ create table t1 (
645
+ pk int,
646
+ a int,
647
+ b int
648
+ );
649
+
650
+ insert into t1 values (1, NULL,1);
651
+ insert into t1 values (2, NULL,1);
652
+ insert into t1 values (3, NULL,1);
653
+ insert into t1 values (4, 10 ,1);
654
+ insert into t1 values (5, 11 ,1);
655
+ insert into t1 values (6, 12 ,1);
656
+ insert into t1 values (7, 13 ,1);
657
+ insert into t1 values (8, 14 ,1);
658
+
659
+
660
+ select
661
+ pk, a,
662
+ count(b) over (order by a
663
+ range between 2 preceding
664
+ and 2 following) as CNT
665
+ from t1;
666
+ drop table t1;
You can’t perform that action at this time.
0 commit comments