statement ok
CREATE TABLE t1(a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER)

statement ok
INSERT INTO t1(e,c,b,d,a) VALUES(103,102,100,101,104)

statement ok
INSERT INTO t1(a,c,d,e,b) VALUES(107,106,108,109,105)

statement ok
INSERT INTO t1(e,d,b,a,c) VALUES(110,114,112,111,113)

statement ok
INSERT INTO t1(d,c,e,a,b) VALUES(116,119,117,115,118)

statement ok
INSERT INTO t1(c,d,b,e,a) VALUES(123,122,124,120,121)

statement ok
INSERT INTO t1(a,d,b,e,c) VALUES(127,128,129,126,125)

statement ok
INSERT INTO t1(e,c,a,d,b) VALUES(132,134,131,133,130)

statement ok
INSERT INTO t1(a,d,b,e,c) VALUES(138,136,139,135,137)

statement ok
INSERT INTO t1(e,c,d,a,b) VALUES(144,141,140,142,143)

statement ok
INSERT INTO t1(b,a,e,d,c) VALUES(145,149,146,148,147)

statement ok
INSERT INTO t1(b,c,a,d,e) VALUES(151,150,153,154,152)

statement ok
INSERT INTO t1(c,e,a,d,b) VALUES(155,157,159,156,158)

statement ok
INSERT INTO t1(c,b,a,d,e) VALUES(161,160,163,164,162)

statement ok
INSERT INTO t1(b,d,a,e,c) VALUES(167,169,168,165,166)

statement ok
INSERT INTO t1(d,b,c,e,a) VALUES(171,170,172,173,174)

statement ok
INSERT INTO t1(e,c,a,d,b) VALUES(177,176,179,178,175)

statement ok
INSERT INTO t1(b,e,a,d,c) VALUES(181,180,182,183,184)

statement ok
INSERT INTO t1(c,a,b,e,d) VALUES(187,188,186,189,185)

statement ok
INSERT INTO t1(d,b,c,e,a) VALUES(190,194,193,192,191)

statement ok
INSERT INTO t1(a,e,b,d,c) VALUES(199,197,198,196,195)

statement ok
INSERT INTO t1(b,c,d,a,e) VALUES(200,202,203,201,204)

statement ok
INSERT INTO t1(c,e,a,b,d) VALUES(208,209,205,206,207)

statement ok
INSERT INTO t1(c,e,a,d,b) VALUES(214,210,213,212,211)

statement ok
INSERT INTO t1(b,c,a,d,e) VALUES(218,215,216,217,219)

statement ok
INSERT INTO t1(b,e,d,a,c) VALUES(223,221,222,220,224)

statement ok
INSERT INTO t1(d,e,b,a,c) VALUES(226,227,228,229,225)

statement ok
INSERT INTO t1(a,c,b,e,d) VALUES(234,231,232,230,233)

statement ok
INSERT INTO t1(e,b,a,c,d) VALUES(237,236,239,235,238)

statement ok
INSERT INTO t1(e,c,b,a,d) VALUES(242,244,240,243,241)

statement ok
INSERT INTO t1(e,d,c,b,a) VALUES(246,248,247,249,245)

query I nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 1
----
358
364
376
382
398
402
410
426
432
440
458
468
478
486
490
1000
1050
1120
1180
1240
1290
1300
1390
1430
1450
1510
1580
1600
1670
1700

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 1,2
----
1529
102
1612
107
1680
112
1757
117
1826
122
1902
127
1985
132
2046
137
2131
142
2202
147
2281
152
2349
157
2432
162
2501
167
2579
172
2654
177
2728
182
2806
187
2878
192
2949
197
3039
202
3114
207
3175
212
3260
217
3331
222
3399
227
3473
232
3553
237
3629
242
3706
247

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(b-c),
       (a+b+c+d+e)/5,
       a+b*2+c*3
  FROM t1
 WHERE (e>c OR e<d)
   AND d>e
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 4,2,1,3,5
----
1680
222
1
112
674
1826
222
1
122
738
1902
222
4
127
760
1985
333
4
132
793
2046
222
2
137
827
2202
444
2
147
880
2281
333
1
152
905
2432
444
1
162
966
2501
333
1
167
1000
2654
444
1
177
1057
2728
333
3
182
1096
3175
333
3
212
1277
3331
222
1
222
1338
3473
333
1
232
1391
3553
444
1
237
1416
3706
111
2
247
1484

query IIIII nosort
SELECT c,
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       e
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
 ORDER BY 1,5,3,2,4
----
102
-2
555
1014
103
106
-1
333
1067
109
113
4
111
1130
110
123
2
333
1226
120
125
2
333
1272
126
134
1
444
1325
132
137
1
111
1371
135
141
-4
111
1411
144
147
2
555
1472
146
150
2
333
1521
152
155
-1
555
1564
157
161
2
333
1622
162
166
4
333
1676
165
172
-2
555
1714
173
176
1
555
1769
177
184
3
333
1828
180
187
-4
444
1861
189
193
-2
444
1918
192
195
-1
555
1964
197
202
-1
222
2019
204
208
-2
111
2069
209
214
2
222
2125
210
215
-2
333
2165
219
224
1
444
2226
221
225
-1
555
2264
227
231
3
555
2323
230
235
1
555
2368
237
244
-1
222
2419
242
247
2
444
2476
246

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       abs(a),
       e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d
  FROM t1
 WHERE b>c
   AND c>d
 ORDER BY 3,4,5,1,2,6
----
1226
122
121
120
333
122
1371
137
138
135
111
136
1411
142
142
144
111
140
1918
192
191
192
444
190

query IIII nosort
SELECT a+b*2+c*3+d*4,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 4,2,1,3
----
1067
333
0
106
1172
333
0
119
1272
333
0
125
1521
333
0
150
1622
333
0
161
1676
333
0
166
1769
555
0
176
1861
444
0
187
1918
444
0
193
2125
222
0
214
2165
333
0
215
2226
444
0
224
2323
555
0
231
2368
555
0
235
2419
222
0
244

query I nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 1
----
111
111
111
111
222
222
222
333
333
333
333
333
333
333
333
333
444
444
444
444
444
555
555
555
555
555
555
555
555
555

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR c>d
 ORDER BY 1
----
0
2
3
4
6
7
8
11
13
14
16
17
18
19
20
21
22
24
25
28

query IIIII nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b-c,
       a-b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR a>b
    OR b>c
 ORDER BY 1,4,3,2,5
----
104
0
-2
4
555
107
0
-1
2
333
111
0
-1
-1
111
121
0
1
-3
333
127
0
4
-2
333
131
0
-4
1
444
138
0
2
-1
111
142
0
2
-1
111
149
0
-2
4
555
153
0
1
2
333
159
0
3
1
555
163
0
-1
3
333
168
0
1
1
333
174
0
-2
4
555
179
0
-1
4
555
182
0
-3
1
333
188
0
-1
2
444
191
0
1
-3
444
199
0
3
1
555
201
0
-2
1
222
205
0
-2
-1
111
213
0
-3
2
222
216
0
3
-2
333
220
0
-1
-3
444
229
0
3
1
555
234
0
1
2
555
239
0
1
3
555
243
0
-4
3
222
245
0
2
-4
444

query IIIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4,
       a+b*2+c*3,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c)
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR b>c
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 4,1,5,2,6,3,7
----
555
444
1014
610
102
1000
2
333
333
1067
635
106
1050
1
111
222
1130
674
113
1120
1
333
222
1172
708
119
1180
1
333
222
1226
738
123
1240
1
333
222
1272
760
125
1290
4
444
333
1325
793
134
1300
4
111
222
1371
827
137
1390
2
111
222
1411
851
141
1430
2
555
444
1472
880
147
1450
2
333
333
1521
905
150
1510
1
555
333
1564
940
155
1580
3
333
444
1622
966
161
1600
1
333
333
1676
1000
166
1670
1
555
444
1714
1030
172
1700
2
555
444
1769
1057
176
358
1
333
333
1828
1096
184
364
3
444
333
1861
1121
187
376
1
444
222
1918
1158
193
382
1
555
333
1964
1180
195
398
3
222
333
2019
1207
202
402
2
111
222
2069
1241
208
410
2
222
333
2125
1277
214
426
3
333
222
2165
1297
215
432
3
444
222
2226
1338
224
440
1
555
333
2264
1360
225
458
3
555
333
2323
1391
231
468
1
555
444
2368
1416
235
478
1
222
444
2419
1455
244
486
4
444
111
2476
1484
247
490
2

query IIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c,
       b-c
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR a>b
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 5,3,6,1,2,4
----
1000
444
610
0
102
-2
1050
333
635
0
106
-1
1120
222
674
0
113
-1
1180
222
708
0
119
-1
1240
222
738
0
123
1
1290
222
760
0
125
4
1300
333
793
0
134
-4
1390
222
827
0
137
2
1430
222
851
0
141
2
1450
444
880
0
147
-2
1510
333
905
0
150
1
1580
333
940
0
155
3
1600
444
966
0
161
-1
1670
333
1000
0
166
1
1700
444
1030
0
172
-2
358
444
1057
0
176
-1
364
333
1096
0
184
-3
376
333
1121
0
187
-1
382
222
1158
0
193
1
398
333
1180
0
195
3
402
333
1207
0
202
-2
410
222
1241
0
208
-2
426
333
1277
0
214
-3
432
222
1297
0
215
3
440
222
1338
0
224
-1
458
333
1360
0
225
3
468
333
1391
0
231
1
478
444
1416
0
235
1
486
444
1455
0
244
-4
490
111
1484
0
247
2

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d,
       a+b*2+c*3+d*4,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR c>d
 ORDER BY 3,5,4,1,2
----
0
101
1014
4
0
0
108
1067
2
1
0
114
1130
-1
2
0
116
1172
-3
3
0
122
1226
-3
4
0
133
1325
1
6
0
136
1371
-1
7
0
140
1411
-1
8
0
148
1472
4
9
0
154
1521
2
10
0
164
1622
3
12
0
169
1676
1
13
0
171
1714
4
14
0
178
1769
4
15
0
183
1828
1
16
0
185
1861
2
17
0
190
1918
-3
18
0
203
2019
1
20
0
207
2069
-1
21
0
212
2125
2
22
0
222
2226
-3
24
0
233
2323
2
26
0
238
2368
3
27
0
241
2419
3
28
0
248
2476
-4
29

query IIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b,
       abs(b-c),
       c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 4,3,6,2,5,1
----
1000
4
2
102
444
1014
1050
2
1
106
333
1067
1120
-1
1
113
222
1130
1180
-3
1
119
222
1172
1240
-3
1
123
222
1226
1290
-2
4
125
222
1272
1300
1
4
134
333
1325
1390
-1
2
137
222
1371
1430
-1
2
141
222
1411
1450
4
2
147
444
1472
1510
2
1
150
333
1521
1580
1
3
155
333
1564
1600
3
1
161
444
1622
1670
1
1
166
333
1676
1700
4
2
172
444
1714
358
4
1
176
444
1769
364
1
3
184
333
1828
376
2
1
187
333
1861
382
-3
1
193
222
1918
398
1
3
195
333
1964
402
1
2
202
333
2019
410
-1
2
208
222
2069
426
2
3
214
333
2125
432
-2
3
215
222
2165
440
-3
1
224
222
2226
458
1
3
225
333
2264
468
2
1
231
333
2323
478
3
1
235
444
2368
486
3
4
244
444
2419
490
-4
2
247
111
2476

query IIIIIII nosort
SELECT a+b*2,
       a,
       a+b*2+c*3+d*4+e*5,
       (a+b+c+d+e)/5,
       e,
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE a>b
 ORDER BY 5,4,6,2,1,7,3
----
304
104
1529
102
103
1
444
317
107
1612
107
109
-2
333
391
131
1985
132
132
1
333
439
149
2202
147
146
-1
444
455
153
2281
152
152
-4
333
475
159
2349
157
157
-1
333
483
163
2432
162
162
-3
444
502
168
2501
167
165
-3
333
514
174
2579
172
173
1
444
529
179
2654
177
177
-2
444
544
182
2728
182
180
1
333
560
188
2806
187
189
2
333
595
199
2949
197
197
-1
333
601
201
3039
202
204
-1
333
635
213
3175
212
210
2
333
685
229
3399
227
227
-1
333
698
234
3473
232
230
-2
333
711
239
3553
237
237
-3
444
723
243
3629
242
242
3
444

query II nosort
SELECT a,
       b
  FROM t1
 ORDER BY 1,2
----
104
100
107
105
111
112
115
118
121
124
127
129
131
130
138
139
142
143
149
145
153
151
159
158
163
160
168
167
174
170
179
175
182
181
188
186
191
194
199
198
201
200
205
206
213
211
216
218
220
223
229
228
234
232
239
236
243
240
245
249

query III nosort
SELECT c,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 1,2,3
----
102
4
0
106
2
1
113
-1
2
123
-3
4
134
1
6
137
-1
7
141
-1
8
147
4
9
150
2
10
161
3
12
166
1
13
172
4
14
176
4
15
184
1
16
187
2
17
202
1
20
208
-1
21
214
2
22
224
-3
24
231
2
26
235
3
27
247
-4
29

query IIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5,
       abs(b-c),
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a-b
  FROM t1
 WHERE b>c
   AND a>b
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 2,1,6,4,3,5
----
1510
2281
1
1
333
2
1580
2349
3
3
555
1
1670
2501
1
1
333
1
398
2949
3
3
555
1
458
3399
3
3
555
1
468
3473
1
1
555
2
478
3553
1
1
555
3

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(a),
       b-c,
       c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,5,4,2,6,3
----
1529
104
-2
1
555
104
1612
107
-1
-2
333
107
1680
111
-1
-1
111
111
1757
115
-1
3
333
115
1826
121
1
1
333
121
1902
127
4
-3
333
127
1985
131
-4
1
444
131
2046
138
2
1
111
138
2131
142
2
1
111
142
2202
149
-2
-1
555
149
2281
153
1
-4
333
153
2432
163
-1
-3
333
163
2501
168
1
-3
333
168
2579
174
-2
1
555
174
2654
179
-1
-2
555
179
2728
182
-3
1
333
182
2806
188
-1
2
444
188
3039
201
-2
-1
222
201
3114
205
-2
1
111
205
3175
213
-3
2
222
213
3331
220
-1
2
444
220
3473
234
1
-2
555
234
3553
239
1
-3
555
239
3706
245
2
-1
444
245

query IIIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2
  FROM t1
 ORDER BY 4,3,5,1,6,2,7
----
333
134
6
-4
130
444
391
444
244
28
-4
240
222
723
333
184
16
-3
181
333
544
333
214
22
-3
211
222
635
444
102
0
-2
100
555
304
444
147
9
-2
145
555
439
444
172
14
-2
170
555
514
333
202
20
-2
200
222
601
222
208
21
-2
206
111
617
333
106
1
-1
105
333
317
222
113
2
-1
112
111
335
222
119
3
-1
118
333
351
444
161
12
-1
160
333
483
444
176
15
-1
175
555
529
333
187
17
-1
186
444
560
222
224
24
-1
223
444
666
222
123
4
1
124
333
369
333
150
10
1
151
333
455
333
166
13
1
167
333
502
222
193
18
1
194
444
579
333
231
26
1
232
555
698
444
235
27
1
236
555
711
222
137
7
2
139
111
416
222
141
8
2
143
111
428
111
247
29
2
249
444
743
333
155
11
3
158
555
475
333
195
19
3
198
555
595
222
215
23
3
218
333
652
333
225
25
3
228
555
685
222
125
5
4
129
333
385

query IIIIII nosort
SELECT a,
       a+b*2+c*3+d*4+e*5,
       c-d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       a+b*2
  FROM t1
 ORDER BY 6,2,4,5,3,1
----
104
1529
1
1000
-2
304
107
1612
-2
1050
-1
317
111
1680
-1
1120
-1
335
115
1757
3
1180
-1
351
121
1826
1
1240
1
369
127
1902
-3
1290
4
385
131
1985
1
1300
-4
391
138
2046
1
1390
2
416
142
2131
1
1430
2
428
149
2202
-1
1450
-2
439
153
2281
-4
1510
1
455
159
2349
-1
1580
3
475
163
2432
-3
1600
-1
483
168
2501
-3
1670
1
502
174
2579
1
1700
-2
514
179
2654
-2
358
-1
529
182
2728
1
364
-3
544
188
2806
2
376
-1
560
191
2878
3
382
1
579
199
2949
-1
398
3
595
201
3039
-1
402
-2
601
205
3114
1
410
-2
617
213
3175
2
426
-3
635
216
3260
-2
432
3
652
220
3331
2
440
-1
666
229
3399
-1
458
3
685
234
3473
-2
468
1
698
239
3553
-3
478
1
711
243
3629
3
486
-4
723
245
3706
-1
490
2
743

query IIIIIII nosort
SELECT d-e,
       abs(a),
       b,
       c-d,
       a+b*2+c*3,
       abs(b-c),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (e>c OR e<d)
   AND d>e
   AND c>d
 ORDER BY 1,3,7,5,2,6,4
----
1
131
130
1
793
4
333
1
138
139
1
827
2
222
1
220
223
2
1338
1
222
2
121
124
1
738
1
222
2
213
211
2
1277
3
333
3
182
181
1
1096
3
333

query IIIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4,
       b-c,
       c
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 2,5,1,7,3,6,4
----
444
610
1529
102
1014
-2
102
333
635
1612
107
1067
-1
106
333
905
2281
152
1521
1
150
333
940
2349
157
1564
3
155
444
966
2432
162
1622
-1
161
333
1000
2501
167
1676
1
166
444
1030
2579
172
1714
-2
172
444
1057
2654
177
1769
-1
176
333
1096
2728
182
1828
-3
184
333
1121
2806
187
1861
-1
187
222
1158
2878
192
1918
1
193
333
1180
2949
197
1964
3
195
333
1207
3039
202
2019
-2
202
222
1241
3114
207
2069
-2
208
333
1277
3175
212
2125
-3
214
222
1297
3260
217
2165
3
215
222
1338
3331
222
2226
-1
224
333
1360
3399
227
2264
3
225
333
1391
3473
232
2323
1
231
444
1416
3553
237
2368
1
235
444
1455
3629
242
2419
-4
244
111
1484
3706
247
2476
2
247

query IIIIII nosort
SELECT e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d,
       c
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,4,5,6,2,3
----
103
0
4
555
1
102
109
1
2
333
-2
106
152
10
2
333
-4
150
157
11
1
555
-1
155
162
12
3
333
-3
161
165
13
1
333
-3
166
173
14
4
555
1
172
177
15
4
555
-2
176
180
16
1
333
1
184
189
17
2
444
2
187
192
18
-3
444
3
193
197
19
1
555
-1
195
204
20
1
222
-1
202
209
21
-1
111
1
208
210
22
2
222
2
214
219
23
-2
333
-2
215
221
24
-3
444
2
224
227
25
1
555
-1
225
230
26
2
555
-2
231
237
27
3
555
-3
235
242
28
3
222
3
244
246
29
-4
444
-1
247

query I nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND c>d
 ORDER BY 1
----
1000
1180
1240

query IIIIIII nosort
SELECT a+b*2+c*3,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       a+b*2+c*3+d*4,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 6,1,7,3,4,5,2
----
674
1
111
111
1130
335
2
793
4
444
131
1325
391
6
827
2
111
138
1371
416
7
851
2
111
142
1411
428
8
1000
1
333
168
1676
502
13
1096
3
333
182
1828
544
16
1207
2
222
201
2019
601
20
1241
2
111
205
2069
617
21

query IIIII nosort
SELECT a+b*2,
       a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE d>e
   AND (c<=d-2 OR c>=d+2)
   AND b>c
 ORDER BY 2,3,1,5,4
----
385
760
1290
125
222
455
905
1510
150
333
502
1000
1670
166
333
698
1391
468
231
333
711
1416
478
235
444

query IIIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       abs(b-c),
       a+b*2,
       d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>c OR e<d)
    OR a>b
 ORDER BY 4,5,3,7,1,6,2
----
1612
333
107
1
317
108
1050
1680
222
111
1
335
114
1120
1826
222
121
1
369
122
1240
2281
333
153
1
455
154
1510
2432
444
163
1
483
164
1600
2501
333
168
1
502
169
1670
2654
444
179
1
529
178
358
2806
333
188
1
560
185
376
3331
222
220
1
666
222
440
3473
333
234
1
698
233
468
3553
444
239
1
711
238
478
1529
444
104
2
304
101
1000
2046
222
138
2
416
136
1390
2131
222
142
2
428
140
1430
2202
444
149
2
439
148
1450
2579
444
174
2
514
171
1700
3039
333
201
2
601
203
402
3114
222
205
2
617
207
410
3706
111
245
2
743
248
490
2349
333
159
3
475
156
1580
2728
333
182
3
544
183
364
2949
333
199
3
595
196
398
3175
333
213
3
635
212
426
3260
222
216
3
652
217
432
3399
333
229
3
685
226
458
1902
222
127
4
385
128
1290
1985
333
131
4
391
133
1300
3629
444
243
4
723
241
486

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c-d,
       a-b
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,5,4,1,2
----
29
0
111
-1
-4
4
0
222
1
-3
24
0
222
2
-3
5
0
222
-3
-2
23
0
222
-2
-2
2
0
222
-1
-1
7
0
222
1
-1
8
0
222
1
-1
21
0
222
1
-1
13
0
333
-3
1
11
0
333
-1
1
19
0
333
-1
1
20
0
333
-1
1
25
0
333
-1
1
6
0
333
1
1
16
0
333
1
1
10
0
333
-4
2
1
0
333
-2
2
26
0
333
-2
2
17
0
333
2
2
22
0
333
2
2
12
0
444
-3
3
27
0
444
-3
3
15
0
444
-2
4
9
0
444
-1
4
0
0
444
1
4
14
0
444
1
4

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND a>b
   AND (a>b-2 AND a<b+2)
 ORDER BY 1
----

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE a>b
    OR c BETWEEN b-2 AND d+2
    OR c>d
 ORDER BY 3,2,1,4,5
----
555
100
304
0
444
333
105
317
1
333
111
112
335
2
222
333
118
351
3
222
333
124
369
4
222
444
130
391
6
333
111
139
416
7
222
111
143
428
8
222
555
145
439
9
444
333
151
455
10
333
555
158
475
11
333
333
160
483
12
444
333
167
502
13
333
555
170
514
14
444
555
175
529
15
444
333
181
544
16
333
444
186
560
17
333
444
194
579
18
222
555
198
595
19
333
222
200
601
20
333
111
206
617
21
222
222
211
635
22
333
444
223
666
24
222
555
228
685
25
333
555
232
698
26
333
555
236
711
27
444
222
240
723
28
444
444
249
743
29
111

query IIIIII nosort
SELECT d,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       c-d,
       (a+b+c+d+e)/5,
       a-b
  FROM t1
 ORDER BY 3,4,2,6,5,1
----
101
1529
610
1
102
4
108
1612
635
-2
107
2
114
1680
674
-1
112
-1
116
1757
708
3
117
-3
122
1826
738
1
122
-3
128
1902
760
-3
127
-2
133
1985
793
1
132
1
136
2046
827
1
137
-1
140
2131
851
1
142
-1
148
2202
880
-1
147
4
154
2281
905
-4
152
2
156
2349
940
-1
157
1
164
2432
966
-3
162
3
169
2501
1000
-3
167
1
171
2579
1030
1
172
4
178
2654
1057
-2
177
4
183
2728
1096
1
182
1
185
2806
1121
2
187
2
190
2878
1158
3
192
-3
196
2949
1180
-1
197
1
203
3039
1207
-1
202
1
207
3114
1241
1
207
-1
212
3175
1277
2
212
2
217
3260
1297
-2
217
-2
222
3331
1338
2
222
-3
226
3399
1360
-1
227
1
233
3473
1391
-2
232
2
238
3553
1416
-3
237
3
241
3629
1455
3
242
3
248
3706
1484
-1
247
-4

query IIIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       (a+b+c+d+e)/5,
       abs(b-c),
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 7,2,5,1,3,6,4
----
555
1529
102
2
104
0
610
333
1612
107
1
107
0
635
111
1680
112
1
111
0
674
333
1826
122
1
121
0
738
444
1985
132
4
131
0
793
111
2046
137
2
138
0
827
111
2131
142
2
142
0
851
555
2202
147
2
149
0
880
333
2281
152
1
153
0
905
333
2432
162
1
163
0
966
333
2501
167
1
168
0
1000
555
2579
172
2
174
0
1030
555
2654
177
1
179
0
1057
333
2728
182
3
182
0
1096
444
2806
187
1
188
0
1121
222
3039
202
2
201
0
1207
111
3114
207
2
205
0
1241
222
3175
212
3
213
0
1277
444
3331
222
1
220
0
1338
555
3473
232
1
234
0
1391
555
3553
237
1
239
0
1416
444
3706
247
2
245
0
1484

query IIIII nosort
SELECT d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       c,
       e
  FROM t1
 WHERE b>c
 ORDER BY 1,2,4,3,5
----
122
1240
124
123
120
128
1290
129
125
126
136
1390
139
137
135
140
1430
143
141
144
154
1510
151
150
152
156
1580
158
155
157
169
1670
167
166
165
190
382
194
193
192
196
398
198
195
197
217
432
218
215
219
226
458
228
225
227
233
468
232
231
230
238
478
236
235
237
248
490
249
247
246

query IIIIII nosort
SELECT a-b,
       a,
       a+b*2+c*3,
       b,
       d,
       d-e
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 2,6,4,1,5,3
----
-3
115
708
118
116
-1
-3
191
1158
194
190
-2
-3
220
1338
223
222
1
-4
245
1484
249
248
2

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2,
       c-d,
       a,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE b>c
 ORDER BY 2,6,5,4,3,1
----
122
369
1
121
120
4
127
385
-3
127
126
5
137
416
1
138
135
7
142
428
1
142
144
8
152
455
-4
153
152
10
157
475
-1
159
157
11
167
502
-3
168
165
13
192
579
3
191
192
18
197
595
-1
199
197
19
217
652
-2
216
219
23
227
685
-1
229
227
25
232
698
-2
234
230
26
237
711
-3
239
237
27
247
743
-1
245
246
29

query IIIII nosort
SELECT b,
       (a+b+c+d+e)/5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       b-c
  FROM t1
 WHERE a>b
 ORDER BY 2,5,3,4,1
----
100
102
555
2
-2
105
107
333
1
-1
130
132
444
4
-4
145
147
555
2
-2
151
152
333
1
1
158
157
555
3
3
160
162
333
1
-1
167
167
333
1
1
170
172
555
2
-2
175
177
555
1
-1
181
182
333
3
-3
186
187
444
1
-1
198
197
555
3
3
200
202
222
2
-2
211
212
222
3
-3
228
227
555
3
3
232
232
555
1
1
236
237
555
1
1
240
242
222
4
-4

query IIII nosort
SELECT abs(b-c),
       a,
       a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 1,4,3,2
----
1
111
335
222
1
115
351
222
1
121
369
222
1
191
579
222
1
220
666
222
1
107
317
333
1
153
455
333
1
168
502
333
1
188
560
333
1
234
698
333
1
163
483
444
1
179
529
444
1
239
711
444
2
245
743
111
2
138
416
222
2
142
428
222
2
205
617
222
2
201
601
333
2
104
304
444
2
149
439
444
2
174
514
444
3
216
652
222
3
159
475
333
3
182
544
333
3
199
595
333
3
213
635
333
3
229
685
333
4
127
385
222
4
131
391
333
4
243
723
444

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c,
       d-e
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND c>d
 ORDER BY 2,1,3
----
333
134
1
222
137
1
222
141
-4
333
184
3
222
208
-2

query IIII nosort
SELECT a,
       e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b
  FROM t1
 ORDER BY 2,4,3,1
----
104
103
1000
4
107
109
1050
2
111
110
1120
-1
115
117
1180
-3
121
120
1240
-3
127
126
1290
-2
131
132
1300
1
138
135
1390
-1
142
144
1430
-1
149
146
1450
4
153
152
1510
2
159
157
1580
1
163
162
1600
3
168
165
1670
1
174
173
1700
4
179
177
358
4
182
180
364
1
188
189
376
2
191
192
382
-3
199
197
398
1
201
204
402
1
205
209
410
-1
213
210
426
2
216
219
432
-2
220
221
440
-3
229
227
458
1
234
230
468
2
239
237
478
3
243
242
486
3
245
246
490
-4

query III nosort
SELECT (a+b+c+d+e)/5,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>c OR e<d)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,1,2
----
102
103
0
107
109
0
112
110
0
117
117
0
122
120
0
127
126
0
132
132
0
137
135
0
142
144
0
147
146
0
152
152
0
157
157
0
162
162
0
167
165
0
172
173
0
177
177
0
182
180
0
187
189
0
192
192
0
197
197
0
202
204
0
207
209
0
212
210
0
217
219
0
222
221
0
227
227
0
232
230
0
237
237
0
242
242
0
247
246
0

query IIII nosort
SELECT a-b,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e
  FROM t1
 WHERE d>e
    OR (e>a AND e<b)
 ORDER BY 4,1,3,2
----
-3
579
0
-2
-3
351
0
-1
-3
666
0
1
-1
416
0
1
1
391
0
1
3
711
0
1
4
529
0
1
-4
743
0
2
-3
369
0
2
-2
385
0
2
2
455
0
2
2
635
0
2
3
483
0
2
4
439
0
2
1
544
0
3
2
698
0
3
-1
335
0
4
1
502
0
4

query I nosort
SELECT a+b*2
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR a>b
 ORDER BY 1
----
304
317
335
351
369
385
391
439
455
475
483
502
514
529
544
560
595
601
635
685
698
711
723

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e,
       b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (a>b-2 AND a<b+2)
 ORDER BY 2,6,3,5,4,1
----
333
0
-1
105
1
317
111
0
4
112
2
335
333
0
-1
118
3
351
333
0
2
124
4
369
333
0
2
129
5
385
444
0
1
130
6
391
111
0
1
139
7
416
111
0
-4
143
8
428
555
0
2
145
9
439
333
0
2
151
10
455
555
0
-1
158
11
475
333
0
2
160
12
483
333
0
4
167
13
502
555
0
-2
170
14
514
555
0
1
175
15
529
333
0
3
181
16
544
444
0
-4
186
17
560
444
0
-2
194
18
579
555
0
-1
198
19
595
222
0
-1
200
20
601
111
0
-2
206
21
617
222
0
2
211
22
635
333
0
-2
218
23
652
444
0
1
223
24
666
555
0
-1
228
25
685
555
0
3
232
26
698
555
0
1
236
27
711
222
0
-1
240
28
723
444
0
2
249
29
743

query III nosort
SELECT a,
       c-d,
       d
  FROM t1
 WHERE c>d
   AND a>b
   AND (a>b-2 AND a<b+2)
 ORDER BY 1,2,3
----
131
1
133
182
1
183

query IIIII nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       c,
       (a+b+c+d+e)/5,
       b
  FROM t1
 ORDER BY 5,4,1,3,2
----
610
1529
102
102
100
635
1612
106
107
105
674
1680
113
112
112
708
1757
119
117
118
738
1826
123
122
124
760
1902
125
127
129
793
1985
134
132
130
827
2046
137
137
139
851
2131
141
142
143
880
2202
147
147
145
905
2281
150
152
151
940
2349
155
157
158
966
2432
161
162
160
1000
2501
166
167
167
1030
2579
172
172
170
1057
2654
176
177
175
1096
2728
184
182
181
1121
2806
187
187
186
1158
2878
193
192
194
1180
2949
195
197
198
1207
3039
202
202
200
1241
3114
208
207
206
1277
3175
214
212
211
1297
3260
215
217
218
1338
3331
224
222
223
1360
3399
225
227
228
1391
3473
231
232
232
1416
3553
235
237
236
1455
3629
244
242
240
1484
3706
247
247
249

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c-d,
       abs(a),
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,5,3,2,4
----
111
-1
245
2
0
222
-1
111
1
0
222
3
115
1
0
222
1
121
1
0
222
-3
127
4
0
222
1
138
2
0
222
1
142
2
0
222
3
191
1
0
222
1
205
2
0
222
-2
216
3
0
222
2
220
1
0
333
-2
107
1
0
333
1
131
4
0
333
-4
153
1
0
333
-1
159
3
0
333
-3
168
1
0
333
1
182
3
0
333
2
188
1
0
333
-1
199
3
0
333
-1
201
2
0
333
2
213
3
0
333
-1
229
3
0
333
-2
234
1
0
444
-1
149
2
0
444
-3
163
1
0
444
1
174
2
0
444
-2
179
1
0
444
-3
239
1
0
444
3
243
4
0

query IIIIII nosort
SELECT c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a),
       (a+b+c+d+e)/5,
       a+b*2,
       d-e
  FROM t1
 WHERE b>c
   AND (a>b-2 AND a<b+2)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 4,5,3,1,2,6
----
155
333
159
157
475
-1
166
333
168
167
502
4
195
333
199
197
595
-1
225
333
229
227
685
-1

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5,
       d
  FROM t1
 WHERE d>e
    OR (a>b-2 AND a<b+2)
 ORDER BY 3,2,4,1
----
111
1120
1680
114
333
1240
1826
122
333
1290
1902
128
444
1300
1985
133
111
1390
2046
136
111
1430
2131
140
555
1450
2202
148
333
1510
2281
154
555
1580
2349
156
333
1600
2432
164
333
1670
2501
169
555
358
2654
178
333
364
2728
183
555
398
2949
196
222
402
3039
203
111
410
3114
207
222
426
3175
212
444
440
3331
222
555
458
3399
226
555
468
3473
233
555
478
3553
238
444
490
3706
248

query IIII nosort
SELECT d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(a),
       a+b*2+c*3+d*4
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR c>d
 ORDER BY 2,3,4,1
----
-2
0
104
1014
-1
1
107
1067
4
2
111
1130
-1
3
115
1172
2
4
121
1226
2
5
127
1272
1
6
131
1325
1
7
138
1371
-4
8
142
1411
2
9
149
1472
2
10
153
1521
-1
11
159
1564
2
12
163
1622
4
13
168
1676
-2
14
174
1714
1
15
179
1769
3
16
182
1828
-4
17
188
1861
-2
18
191
1918
-1
19
199
1964
-1
20
201
2019
-2
21
205
2069
2
22
213
2125
-2
23
216
2165
1
24
220
2226
-1
25
229
2264
3
26
234
2323
1
27
239
2368
-1
28
243
2419
2
29
245
2476

query I nosort
SELECT a+b*2+c*3
  FROM t1
 ORDER BY 1
----
610
635
674
708
738
760
793
827
851
880
905
940
966
1000
1030
1057
1096
1121
1158
1180
1207
1241
1277
1297
1338
1360
1391
1416
1455
1484

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4,
       a+b*2
  FROM t1
 WHERE d>e
 ORDER BY 3,4,1,2,5
----
222
1680
2
1130
335
222
1826
4
1226
369
222
1902
5
1272
385
333
1985
6
1325
391
222
2046
7
1371
416
444
2202
9
1472
439
333
2281
10
1521
455
444
2432
12
1622
483
333
2501
13
1676
502
444
2654
15
1769
529
333
2728
16
1828
544
333
3175
22
2125
635
222
3331
24
2226
666
333
3473
26
2323
698
444
3553
27
2368
711
111
3706
29
2476
743

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a-b
  FROM t1
 WHERE b>c
 ORDER BY 1,2
----
0
-4
0
-3
0
-3
0
-2
0
-2
0
-1
0
-1
0
1
0
1
0
1
0
1
0
2
0
2
0
3

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       b-c
  FROM t1
 WHERE d>e
 ORDER BY 4,1,5,3,2
----
1680
111
111
1130
-1
1826
121
333
1226
1
1902
127
333
1272
4
1985
131
444
1325
-4
2046
138
111
1371
2
2202
149
555
1472
-2
2281
153
333
1521
1
2432
163
333
1622
-1
2501
168
333
1676
1
2654
179
555
1769
-1
2728
182
333
1828
-3
3175
213
222
2125
-3
3331
220
444
2226
-1
3473
234
555
2323
1
3553
239
555
2368
1
3706
245
444
2476
2

query III nosort
SELECT a-b,
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1,2,3
----
-4
2476
0
-3
1226
0
-3
2226
0
-2
1272
0
-2
2165
0
-1
1130
0
-1
1371
0
-1
1411
0
-1
2069
0
1
1325
0
1
1564
0
1
1676
0
1
1828
0
1
1964
0
1
2019
0
1
2264
0
2
1067
0
2
1521
0
2
1861
0
2
2125
0
2
2323
0
3
1622
0
3
2368
0
4
1014
0
4
1472
0
4
1714
0
4
1769
0

query IIIIIII nosort
SELECT d,
       a+b*2,
       a,
       b,
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 5,2,7,1,4,6,3
----
133
391
131
130
-4
444
132
241
723
243
240
-4
222
242
183
544
182
181
-3
333
182
212
635
213
211
-3
222
212
101
304
104
100
-2
555
102
148
439
149
145
-2
555
147
171
514
174
170
-2
555
172
203
601
201
200
-2
222
202
207
617
205
206
-2
111
207
108
317
107
105
-1
333
107
114
335
111
112
-1
111
112
116
351
115
118
-1
333
117
164
483
163
160
-1
333
162
178
529
179
175
-1
555
177
185
560
188
186
-1
444
187
222
666
220
223
-1
444
222
122
369
121
124
1
333
122
154
455
153
151
1
333
152
169
502
168
167
1
333
167
190
579
191
194
1
444
192
233
698
234
232
1
555
232
238
711
239
236
1
555
237
136
416
138
139
2
111
137
140
428
142
143
2
111
142
248
743
245
249
2
444
247
156
475
159
158
3
555
157
196
595
199
198
3
555
197
217
652
216
218
3
333
217
226
685
229
228
3
555
227
128
385
127
129
4
333
127

query I nosort
SELECT e
  FROM t1
 WHERE b>c
   AND d>e
 ORDER BY 1
----
120
126
135
152
165
230
237
246

query II nosort
SELECT b,
       e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 2,1
----
105
109
118
117
129
126
151
152
160
162
167
165
175
177
186
189
194
192
211
210
218
219
223
221
232
230
236
237
240
242

query IIII nosort
SELECT b-c,
       d-e,
       c-d,
       a+b*2+c*3
  FROM t1
 ORDER BY 1,2,4,3
----
-4
-1
3
1455
-4
1
1
793
-3
2
2
1277
-3
3
1
1096
-2
-2
1
610
-2
-2
1
1030
-2
-2
1
1241
-2
-1
-1
1207
-2
2
-1
880
-1
-4
2
1121
-1
-1
-2
635
-1
-1
3
708
-1
1
-2
1057
-1
1
2
1338
-1
2
-3
966
-1
4
-1
674
1
-2
3
1158
1
1
-3
1416
1
2
1
738
1
2
-4
905
1
3
-2
1391
1
4
-3
1000
2
-4
1
851
2
1
1
827
2
2
-1
1484
3
-2
-2
1297
3
-1
-1
940
3
-1
-1
1180
3
-1
-1
1360
4
2
-3
760

query II nosort
SELECT abs(b-c),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (e>c OR e<d)
    OR b>c
    OR (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
2
111
1
222
1
222
1
222
1
222
2
222
2
222
2
222
3
222
4
222
1
333
1
333
1
333
1
333
1
333
2
333
3
333
3
333
3
333
3
333
3
333
4
333
1
444
1
444
1
444
2
444
2
444
2
444

query IIII nosort
SELECT e,
       d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,3,4,2
----
103
-2
1000
0
109
-1
1050
1
152
2
1510
10
157
-1
1580
11
162
2
1600
12
165
4
1670
13
173
-2
1700
14
177
1
358
15
180
3
364
16
189
-4
376
17
192
-2
382
18
197
-1
398
19
204
-1
402
20
209
-2
410
21
210
2
426
22
219
-2
432
23
221
1
440
24
227
-1
458
25
230
3
468
26
237
1
478
27
242
-1
486
28
246
2
490
29

query III nosort
SELECT abs(a),
       a+b*2+c*3+d*4+e*5,
       c-d
  FROM t1
 ORDER BY 3,2,1
----
153
2281
-4
127
1902
-3
163
2432
-3
168
2501
-3
239
3553
-3
107
1612
-2
179
2654
-2
216
3260
-2
234
3473
-2
111
1680
-1
149
2202
-1
159
2349
-1
199
2949
-1
201
3039
-1
229
3399
-1
245
3706
-1
104
1529
1
121
1826
1
131
1985
1
138
2046
1
142
2131
1
174
2579
1
182
2728
1
205
3114
1
188
2806
2
213
3175
2
220
3331
2
115
1757
3
191
2878
3
243
3629
3

query IIIII nosort
SELECT abs(a),
       c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2,
       d-e
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d>e
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 5,3,1,4,2
----
220
224
444
666
1
179
176
555
529
1
239
235
555
711
1
213
214
222
635
2
153
150
333
455
2
163
161
333
483
2
245
247
444
743
2
182
184
333
544
3
234
231
555
698
3
168
166
333
502
4

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d,
       a+b*2+c*3+d*4,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>a AND e<b)
   AND c>d
 ORDER BY 2,5,6,4,1,3
----
117
3
1180
3
1172
1757
192
18
382
3
1918
2878
222
24
440
2
2226
3331

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d,
       b-c,
       (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a-b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 7,2,4,1,5,6,3
----
0
248
2
247
111
444
-4
0
116
-1
117
222
333
-3
0
122
1
122
222
333
-3
0
190
1
192
222
444
-3
0
222
-1
222
222
444
-3
0
128
4
127
222
333
-2
0
217
3
217
222
333
-2
0
114
-1
112
222
111
-1
0
136
2
137
222
111
-1
0
140
2
142
222
111
-1
0
207
-2
207
222
111
-1
0
133
-4
132
333
444
1
0
156
3
157
333
555
1
0
169
1
167
333
333
1
0
183
-3
182
333
333
1
0
196
3
197
333
555
1
0
203
-2
202
333
222
1
0
226
3
227
333
555
1
0
108
-1
107
333
333
2
0
154
1
152
333
333
2
0
185
-1
187
333
444
2
0
212
-3
212
333
222
2
0
233
1
232
333
555
2
0
164
-1
162
444
333
3
0
238
1
237
444
555
3
0
241
-4
242
444
222
3
0
101
-2
102
444
555
4
0
148
-2
147
444
555
4
0
171
-2
172
444
555
4
0
178
-1
177
444
555
4

query IIIII nosort
SELECT a+b*2,
       d,
       a,
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND d NOT BETWEEN 110 AND 150
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,2,4,5,3
----
317
108
107
-1
333

query IIII nosort
SELECT c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 3,2,4,1
----
3
3
119
1757
3
18
193
2878
2
24
224
3331
-1
29
247
3706

query I nosort
SELECT e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (a>b-2 AND a<b+2)
 ORDER BY 1
----
165

query IIIII nosort
SELECT abs(b-c),
       a+b*2+c*3+d*4+e*5,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c-d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,4,5,1,2
----
2
2131
-4
8
1
1
2806
-4
17
2
2
2579
-2
14
1
1
2878
-2
18
3
2
3114
-2
21
1
3
3260
-2
23
-2
1
1612
-1
1
-2
1
1757
-1
3
3
3
2349
-1
11
-1
3
2949
-1
19
-1
2
3039
-1
20
-1
3
3399
-1
25
-1
4
3629
-1
28
3
4
1985
1
6
1
2
2046
1
7
1
1
2654
1
15
-2
1
3331
1
24
2
1
3553
1
27
-3
1
1826
2
4
1
4
1902
2
5
-3
2
2202
2
9
-1
1
2281
2
10
-4
1
2432
2
12
-3
3
3175
2
22
2
2
3706
2
29
-1
3
2728
3
16
1
1
3473
3
26
-2
1
1680
4
2
-1
1
2501
4
13
-3

query II nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d>e
 ORDER BY 1,2
----
111
3706
222
1680
222
1826
222
2046
222
3331
333
1985
333
2281
333
2501
333
2728
333
3175
333
3473
444
2202
444
2432
444
2654
444
3553

query I nosort
SELECT b-c
  FROM t1
 ORDER BY 1
----
-4
-4
-3
-3
-2
-2
-2
-2
-2
-1
-1
-1
-1
-1
-1
-1
1
1
1
1
1
1
2
2
2
3
3
3
3
4

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(b-c),
       a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       d-e,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,6,2,4,5,3
----
0
1
1067
107
-1
1612
0
1
1130
112
4
1680
0
1
1172
117
-1
1757
0
1
1226
122
2
1826
0
4
1272
127
2
1902
0
4
1325
132
1
1985
0
2
1371
137
1
2046
0
2
1411
142
-4
2131
0
2
1472
147
2
2202
0
1
1521
152
2
2281
0
3
1564
157
-1
2349
0
1
1622
162
2
2432
0
1
1676
167
4
2501
0
2
1714
172
-2
2579
0
1
1769
177
1
2654
0
3
1828
182
3
2728
0
1
1861
187
-4
2806
0
1
1918
192
-2
2878
0
3
1964
197
-1
2949
0
2
2019
202
-1
3039
0
2
2069
207
-2
3114
0
3
2125
212
2
3175
0
3
2165
217
-2
3260
0
1
2226
222
1
3331
0
3
2264
227
-1
3399
0
1
2323
232
3
3473
0
1
2368
237
1
3553
0
4
2419
242
-1
3629
0
2
2476
247
2
3706

query IIIIII nosort
SELECT d,
       c,
       b,
       a+b*2+c*3+d*4,
       b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR c>d
    OR (a>b-2 AND a<b+2)
 ORDER BY 3,5,6,2,4,1
----
101
102
100
1014
-2
444
108
106
105
1067
-1
333
114
113
112
1130
-1
222
116
119
118
1172
-1
222
122
123
124
1226
1
222
128
125
129
1272
4
222
133
134
130
1325
-4
333
136
137
139
1371
2
222
140
141
143
1411
2
222
148
147
145
1472
-2
444
154
150
151
1521
1
333
156
155
158
1564
3
333
164
161
160
1622
-1
444
169
166
167
1676
1
333
171
172
170
1714
-2
444
178
176
175
1769
-1
444
183
184
181
1828
-3
333
185
187
186
1861
-1
333
190
193
194
1918
1
222
196
195
198
1964
3
333
203
202
200
2019
-2
333
207
208
206
2069
-2
222
212
214
211
2125
-3
333
217
215
218
2165
3
222
222
224
223
2226
-1
222
226
225
228
2264
3
333
233
231
232
2323
1
333
238
235
236
2368
1
444
241
244
240
2419
-4
444
248
247
249
2476
2
111

query IIIIII nosort
SELECT b-c,
       (a+b+c+d+e)/5,
       c-d,
       b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE d>e
   AND d NOT BETWEEN 110 AND 150
   AND (e>a AND e<b)
 ORDER BY 1,3,2,5,4,6
----
-1
222
2
223
222
3331
2
247
-1
249
111
3706

query IIII nosort
SELECT abs(a),
       a+b*2+c*3+d*4+e*5,
       a,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 4,3,2,1
----
104
1529
104
102
107
1612
107
107
111
1680
111
112
115
1757
115
117
121
1826
121
122
127
1902
127
127
131
1985
131
132
138
2046
138
137
142
2131
142
142
149
2202
149
147
153
2281
153
152
159
2349
159
157
163
2432
163
162
168
2501
168
167
174
2579
174
172
179
2654
179
177
182
2728
182
182
188
2806
188
187
191
2878
191
192
199
2949
199
197
201
3039
201
202
205
3114
205
207
213
3175
213
212
216
3260
216
217
220
3331
220
222
229
3399
229
227
234
3473
234
232
239
3553
239
237
243
3629
243
242
245
3706
245
247

query IIIII nosort
SELECT b,
       c,
       a-b,
       d-e,
       a+b*2+c*3+d*4
  FROM t1
 WHERE d>e
    OR c BETWEEN b-2 AND d+2
 ORDER BY 2,1,4,3,5
----
100
102
4
-2
1014
105
106
2
-1
1067
112
113
-1
4
1130
124
123
-3
2
1226
129
125
-2
2
1272
130
134
1
1
1325
139
137
-1
1
1371
143
141
-1
-4
1411
145
147
4
2
1472
151
150
2
2
1521
160
161
3
2
1622
167
166
1
4
1676
170
172
4
-2
1714
175
176
4
1
1769
181
184
1
3
1828
186
187
2
-4
1861
200
202
1
-1
2019
206
208
-1
-2
2069
211
214
2
2
2125
223
224
-3
1
2226
232
231
2
3
2323
236
235
3
1
2368
249
247
-4
2
2476

query II nosort
SELECT a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND b>c
   AND (a>b-2 AND a<b+2)
 ORDER BY 1,2
----
-1
222
-1
222
1
333

query IIII nosort
SELECT b,
       abs(a),
       a,
       c
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
    OR b>c
 ORDER BY 4,3,2,1
----
100
104
104
102
105
107
107
106
112
111
111
113
124
121
121
123
129
127
127
125
130
131
131
134
139
138
138
137
143
142
142
141
145
149
149
147
151
153
153
150
158
159
159
155
160
163
163
161
167
168
168
166
170
174
174
172
175
179
179
176
181
182
182
184
186
188
188
187
194
191
191
193
198
199
199
195
200
201
201
202
206
205
205
208
211
213
213
214
218
216
216
215
223
220
220
224
228
229
229
225
232
234
234
231
236
239
239
235
249
245
245
247

query IIII nosort
SELECT a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c-d,
       a+b*2
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND b>c
 ORDER BY 2,4,3,1
----
1226
4
1
369
1272
5
-3
385
1371
7
1
416
1411
8
1
428
1521
10
-4
455
1564
11
-1
475
1676
13
-3
502
1918
18
3
579
1964
19
-1
595
2165
23
-2
652
2264
25
-1
685
2323
26
-2
698
2368
27
-3
711
2476
29
-1
743

query II nosort
SELECT b,
       abs(b-c)
  FROM t1
 WHERE c>d
   AND a>b
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1
----
186
1
170
2
181
3
211
3
130
4
240
4

query IIIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d-e,
       b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a-b,
       a,
       e
  FROM t1
 ORDER BY 4,5,1,3,7,6,2
----
111
2
249
0
-4
245
246
222
-1
118
0
-3
115
117
222
2
124
0
-3
121
120
222
-2
194
0
-3
191
192
222
1
223
0
-3
220
221
222
2
129
0
-2
127
126
222
-2
218
0
-2
216
219
222
4
112
0
-1
111
110
222
1
139
0
-1
138
135
222
-4
143
0
-1
142
144
222
-2
206
0
-1
205
209
333
1
130
0
1
131
132
333
-1
158
0
1
159
157
333
4
167
0
1
168
165
333
3
181
0
1
182
180
333
-1
198
0
1
199
197
333
-1
200
0
1
201
204
333
-1
228
0
1
229
227
333
-1
105
0
2
107
109
333
2
151
0
2
153
152
333
-4
186
0
2
188
189
333
2
211
0
2
213
210
333
3
232
0
2
234
230
444
2
160
0
3
163
162
444
1
236
0
3
239
237
444
-1
240
0
3
243
242
444
-2
100
0
4
104
103
444
2
145
0
4
149
146
444
-2
170
0
4
174
173
444
1
175
0
4
179
177

query IIIIII nosort
SELECT d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c),
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d-e
  FROM t1
 ORDER BY 1,6,2,3,5,4
----
101
1000
2
1529
444
-2
108
1050
1
1612
333
-1
114
1120
1
1680
222
4
116
1180
1
1757
222
-1
122
1240
1
1826
222
2
128
1290
4
1902
222
2
133
1300
4
1985
333
1
136
1390
2
2046
222
1
140
1430
2
2131
222
-4
148
1450
2
2202
444
2
154
1510
1
2281
333
2
156
1580
3
2349
333
-1
164
1600
1
2432
444
2
169
1670
1
2501
333
4
171
1700
2
2579
444
-2
178
358
1
2654
444
1
183
364
3
2728
333
3
185
376
1
2806
333
-4
190
382
1
2878
222
-2
196
398
3
2949
333
-1
203
402
2
3039
333
-1
207
410
2
3114
222
-2
212
426
3
3175
333
2
217
432
3
3260
222
-2
222
440
1
3331
222
1
226
458
3
3399
333
-1
233
468
1
3473
333
3
238
478
1
3553
444
1
241
486
4
3629
444
-1
248
490
2
3706
111
2

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 2,1,3
----
444
304
0
333
317
0
222
335
0
222
369
0
222
385
0
333
391
0
222
416
0
222
428
0
444
439
0
333
455
0
333
475
0
444
483
0
333
502
0
444
514
0
444
529
0
333
544
0
333
560
0
333
595
0
333
601
0
222
617
0
333
635
0
222
652
0
222
666
0
333
685
0
333
698
0
444
711
0
111
743
0

query III nosort
SELECT a+b*2+c*3+d*4,
       abs(b-c),
       c-d
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 2,3,1
----
1521
1
-4
1622
1
-3
1676
1
-3
2368
1
-3
1067
1
-2
1769
1
-2
2323
1
-2
1130
1
-1
1226
1
1
1861
1
2
2226
1
2
1472
2
-1
2019
2
-1
2476
2
-1
1014
2
1
1371
2
1
1411
2
1
1714
2
1
2069
2
1
2165
3
-2
1564
3
-1
1964
3
-1
2264
3
-1
1828
3
1
2125
3
2
1272
4
-3
1325
4
1

query III nosort
SELECT a-b,
       abs(a),
       d
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR d>e
    OR c BETWEEN b-2 AND d+2
 ORDER BY 3,2,1
----
4
104
101
2
107
108
-1
111
114
-3
115
116
-3
121
122
-2
127
128
1
131
133
-1
138
136
-1
142
140
4
149
148
2
153
154
1
159
156
3
163
164
1
168
169
4
174
171
4
179
178
1
182
183
2
188
185
-3
191
190
1
199
196
1
201
203
-1
205
207
2
213
212
-2
216
217
-3
220
222
1
229
226
2
234
233
3
239
238
3
243
241
-4
245
248

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>a AND e<b)
    OR (c<=d-2 OR c>=d+2)
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,1
----
0
1529
0
1612
0
1680
0
1757
0
1826
0
1902
0
2281
0
2432
0
2501
0
2654
0
2806
0
2878
0
3175
0
3260
0
3331
0
3473
0
3553
0
3629
0
3706

query III nosort
SELECT (a+b+c+d+e)/5,
       abs(a),
       d
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND (e>c OR e<d)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1,3
----
107
107
108
112
111
114
122
121
122
127
127
128

query IIIIIII nosort
SELECT a+b*2,
       a+b*2+c*3+d*4+e*5,
       a-b,
       abs(b-c),
       c,
       b,
       e
  FROM t1
 WHERE d>e
 ORDER BY 4,5,3,6,2,1,7
----
335
1680
-1
1
113
112
110
369
1826
-3
1
123
124
120
455
2281
2
1
150
151
152
483
2432
3
1
161
160
162
502
2501
1
1
166
167
165
529
2654
4
1
176
175
177
666
3331
-3
1
224
223
221
698
3473
2
1
231
232
230
711
3553
3
1
235
236
237
416
2046
-1
2
137
139
135
439
2202
4
2
147
145
146
743
3706
-4
2
247
249
246
544
2728
1
3
184
181
180
635
3175
2
3
214
211
210
385
1902
-2
4
125
129
126
391
1985
1
4
134
130
132

query IIIII nosort
SELECT a,
       d,
       a+b*2+c*3+d*4+e*5,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (a>b-2 AND a<b+2)
    OR b>c
 ORDER BY 1,3,5,4,2
----
104
101
1529
4
0
107
108
1612
2
0
111
114
1680
-1
0
121
122
1826
-3
0
127
128
1902
-2
0
131
133
1985
1
0
138
136
2046
-1
0
142
140
2131
-1
0
149
148
2202
4
0
153
154
2281
2
0
159
156
2349
1
0
163
164
2432
3
0
168
169
2501
1
0
174
171
2579
4
0
179
178
2654
4
0
182
183
2728
1
0
188
185
2806
2
0
191
190
2878
-3
0
199
196
2949
1
0
201
203
3039
1
0
205
207
3114
-1
0
213
212
3175
2
0
216
217
3260
-2
0
220
222
3331
-3
0
229
226
3399
1
0
234
233
3473
2
0
239
238
3553
3
0
245
248
3706
-4
0

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3,
       d-e,
       b,
       a,
       c,
       a+b*2
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR (e>a AND e<b)
    OR d>e
 ORDER BY 5,6,3,7,2,1,4
----
0
635
-1
105
107
106
317
0
674
4
112
111
113
335
0
708
-1
118
115
119
351
0
738
2
124
121
123
369
0
760
2
129
127
125
385
0
793
1
130
131
134
391
0
827
1
139
138
137
416
0
880
2
145
149
147
439
0
905
2
151
153
150
455
0
966
2
160
163
161
483
0
1000
4
167
168
166
502
0
1057
1
175
179
176
529
0
1096
3
181
182
184
544
0
1121
-4
186
188
187
560
0
1158
-2
194
191
193
579
0
1277
2
211
213
214
635
0
1297
-2
218
216
215
652
0
1338
1
223
220
224
666
0
1391
3
232
234
231
698
0
1416
1
236
239
235
711
0
1455
-1
240
243
244
723
0
1484
2
249
245
247
743

query IIIII nosort
SELECT b-c,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c-d
  FROM t1
 WHERE c>d
    OR (a>b-2 AND a<b+2)
    OR b>c
 ORDER BY 1,3,5,2,4
----
-4
244
486
28
3
-4
134
1300
6
1
-3
184
364
16
1
-3
214
426
22
2
-2
202
402
20
-1
-2
208
410
21
1
-2
102
1000
0
1
-2
172
1700
14
1
-1
187
376
17
2
-1
224
440
24
2
-1
113
1120
2
-1
-1
119
1180
3
3
1
193
382
18
3
1
231
468
26
-2
1
235
478
27
-3
1
123
1240
4
1
1
150
1510
10
-4
1
166
1670
13
-3
2
247
490
29
-1
2
137
1390
7
1
2
141
1430
8
1
3
195
398
19
-1
3
215
432
23
-2
3
225
458
25
-1
3
155
1580
11
-1
4
125
1290
5
-3

query IIIIIII nosort
SELECT b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a),
       c-d,
       d
  FROM t1
 WHERE b>c
    OR d NOT BETWEEN 110 AND 150
    OR (e>c OR e<d)
 ORDER BY 4,6,5,1,3,7,2
----
1
333
455
0
153
-4
154
4
222
385
0
127
-3
128
-1
444
483
0
163
-3
164
1
333
502
0
168
-3
169
1
444
711
0
239
-3
238
-1
333
317
0
107
-2
108
-1
444
529
0
179
-2
178
3
222
652
0
216
-2
217
1
333
698
0
234
-2
233
-1
222
335
0
111
-1
114
-2
444
439
0
149
-1
148
3
333
475
0
159
-1
156
3
333
595
0
199
-1
196
-2
333
601
0
201
-1
203
3
333
685
0
229
-1
226
2
111
743
0
245
-1
248
-2
444
304
0
104
1
101
1
222
369
0
121
1
122
-4
333
391
0
131
1
133
2
222
416
0
138
1
136
2
222
428
0
142
1
140
-2
444
514
0
174
1
171
-3
333
544
0
182
1
183
-2
222
617
0
205
1
207
-1
333
560
0
188
2
185
-3
333
635
0
213
2
212
-1
222
666
0
220
2
222
1
222
579
0
191
3
190
-4
444
723
0
243
3
241

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (c<=d-2 OR c>=d+2)
    OR c>d
 ORDER BY 1,3,2
----
0
247
111
0
112
222
0
117
222
0
122
222
0
127
222
0
137
222
0
142
222
0
192
222
0
207
222
0
217
222
0
222
222
0
107
333
0
132
333
0
152
333
0
167
333
0
182
333
0
187
333
0
202
333
0
212
333
0
232
333
0
102
444
0
147
444
0
162
444
0
172
444
0
177
444
0
237
444
0
242
444

query II nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3
  FROM t1
 ORDER BY 2,1
----
555
610
333
635
111
674
333
708
333
738
333
760
444
793
111
827
111
851
555
880
333
905
555
940
333
966
333
1000
555
1030
555
1057
333
1096
444
1121
444
1158
555
1180
222
1207
111
1241
222
1277
333
1297
444
1338
555
1360
555
1391
555
1416
222
1455
444
1484

query IIIIIII nosort
SELECT a+b*2+c*3+d*4,
       c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3,
       a+b*2,
       d-e
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,3,7,2,5,6,4
----
1067
106
333
1
635
317
-1
1130
113
222
2
674
335
4
1172
119
222
3
708
351
-1
1226
123
222
4
738
369
2
1272
125
222
5
760
385
2
1325
134
333
6
793
391
1
1371
137
222
7
827
416
1
1411
141
222
8
851
428
-4
1472
147
444
9
880
439
2
1521
150
333
10
905
455
2
1564
155
333
11
940
475
-1
1622
161
444
12
966
483
2
1676
166
333
13
1000
502
4
1714
172
444
14
1030
514
-2
1769
176
444
15
1057
529
1
1828
184
333
16
1096
544
3
1861
187
333
17
1121
560
-4
1918
193
222
18
1158
579
-2
1964
195
333
19
1180
595
-1
2019
202
333
20
1207
601
-1
2069
208
222
21
1241
617
-2
2125
214
333
22
1277
635
2
2165
215
222
23
1297
652
-2
2226
224
222
24
1338
666
1
2264
225
333
25
1360
685
-1
2323
231
333
26
1391
698
3
2368
235
444
27
1416
711
1
2419
244
444
28
1455
723
-1
2476
247
111
29
1484
743
2

query IIIIIII nosort
SELECT abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       d,
       a
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 6,2,4,3,1,7,5
----
107
333
317
1
2
108
107
153
333
455
10
2
154
153
163
444
483
12
3
164
163
168
333
502
13
1
169
168
179
444
529
15
4
178
179
188
333
560
17
2
185
188
213
333
635
22
2
212
213
220
222
666
24
-3
222
220
234
333
698
26
2
233
234
239
444
711
27
3
238
239

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       a-b,
       b,
       a+b*2,
       a
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND (e>c OR e<d)
   AND d>e
 ORDER BY 4,2,5,3,1
----
112
-1
112
335
111
132
1
130
391
131
137
-1
139
416
138
167
1
167
502
168
182
1
181
544
182

query IIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       e,
       c-d,
       a+b*2+c*3+d*4,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND c>d
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,4,3,2,5,6
----
364
183
180
1
1828
333
376
185
189
2
1861
444
410
207
209
1
2069
111
426
212
210
2
2125
222
440
222
221
2
2226
444
1240
122
120
1
1226
333
1300
133
132
1
1325
444
1390
136
135
1
1371
111
1430
140
144
1
1411
111
1700
171
173
1
1714
555

query IIIIIII nosort
SELECT c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       abs(a),
       abs(b-c),
       a+b*2+c*3,
       e
  FROM t1
 WHERE d>e
   AND (e>a AND e<b)
 ORDER BY 7,2,6,1,3,4,5
----
2
444
220
220
1
1338
221
-1
444
245
245
2
1484
246

query IIIII nosort
SELECT c-d,
       d-e,
       abs(a),
       a,
       (a+b+c+d+e)/5
  FROM t1
 WHERE a>b
    OR c>d
 ORDER BY 1,5,3,2,4
----
-4
2
153
153
152
-3
2
163
163
162
-3
4
168
168
167
-3
1
239
239
237
-2
-1
107
107
107
-2
1
179
179
177
-2
3
234
234
232
-1
2
149
149
147
-1
-1
159
159
157
-1
-1
199
199
197
-1
-1
201
201
202
-1
-1
229
229
227
1
-2
104
104
102
1
2
121
121
122
1
1
131
131
132
1
1
138
138
137
1
-4
142
142
142
1
-2
174
174
172
1
3
182
182
182
1
-2
205
205
207
2
-4
188
188
187
2
2
213
213
212
2
1
220
220
222
3
-1
115
115
117
3
-2
191
191
192
3
-1
243
243
242

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a,
       abs(a),
       a-b,
       d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND b>c
 ORDER BY 4,6,3,1,5,2
----
3706
245
245
-4
2
490
2878
191
191
-3
-2
382
1826
121
121
-3
2
1240
3260
216
216
-2
-2
432
1902
127
127
-2
2
1290
2046
138
138
-1
1
1390
2131
142
142
-1
-4
1430
2949
199
199
1
-1
398
3399
229
229
1
-1
458
2349
159
159
1
-1
1580
2501
168
168
1
4
1670
3473
234
234
2
3
468
2281
153
153
2
2
1510
3553
239
239
3
1
478

query II nosort
SELECT a+b*2+c*3,
       a
  FROM t1
 WHERE (e>c OR e<d)
    OR a>b
 ORDER BY 1,2
----
610
104
635
107
674
111
738
121
760
127
793
131
827
138
851
142
880
149
905
153
940
159
966
163
1000
168
1030
174
1057
179
1096
182
1121
188
1180
199
1207
201
1241
205
1277
213
1297
216
1338
220
1360
229
1391
234
1416
239
1455
243
1484
245

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d,
       a+b*2+c*3
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (a>b-2 AND a<b+2)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,3
----
333
-3
1000

query IIIII nosort
SELECT a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       a+b*2+c*3
  FROM t1
 WHERE d>e
 ORDER BY 4,2,1,5,3
----
455
333
0
-4
905
385
222
0
-3
760
502
333
0
-3
1000
483
444
0
-3
966
711
444
0
-3
1416
698
333
0
-2
1391
529
444
0
-2
1057
743
111
0
-1
1484
335
222
0
-1
674
439
444
0
-1
880
369
222
0
1
738
416
222
0
1
827
391
333
0
1
793
544
333
0
1
1096
666
222
0
2
1338
635
333
0
2
1277

query I nosort
SELECT e
  FROM t1
 ORDER BY 1
----
103
109
110
117
120
126
132
135
144
146
152
157
162
165
173
177
180
189
192
197
204
209
210
219
221
227
230
237
242
246

query IIIIII nosort
SELECT c-d,
       b,
       d,
       a+b*2+c*3+d*4+e*5,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE c>d
 ORDER BY 4,3,5,6,2,1
----
1
100
101
1529
304
0
3
118
116
1757
351
3
1
124
122
1826
369
4
1
130
133
1985
391
6
1
139
136
2046
416
7
1
143
140
2131
428
8
1
170
171
2579
514
14
1
181
183
2728
544
16
2
186
185
2806
560
17
3
194
190
2878
579
18
1
206
207
3114
617
21
2
211
212
3175
635
22
2
223
222
3331
666
24
3
240
241
3629
723
28

query IIIII nosort
SELECT abs(b-c),
       c-d,
       a,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR b>c
 ORDER BY 4,2,1,5,3
----
2
-1
245
111
-4
4
-3
127
222
-2
3
-2
216
222
-2
1
-1
111
222
-1
1
1
121
222
-3
2
1
138
222
-1
2
1
142
222
-1
2
1
205
222
-1
1
2
220
222
-3
1
3
115
222
-3
1
3
191
222
-3
1
-4
153
333
2
1
-3
168
333
1
1
-2
107
333
2
1
-2
234
333
2
2
-1
201
333
1
3
-1
159
333
1
3
-1
199
333
1
3
-1
229
333
1
3
1
182
333
1
4
1
131
333
1
1
2
188
333
2
3
2
213
333
2
1
-3
163
444
3
1
-3
239
444
3
1
-2
179
444
4
2
-1
149
444
4
2
1
174
444
4
4
3
243
444
3

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3
  FROM t1
 WHERE c>d
   AND b>c
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,4,1,2
----
4
1
1240
738

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 ORDER BY 1
----
102
107
112
117
122
127
132
137
142
147
152
157
162
167
172
177
182
187
192
197
202
207
212
217
222
227
232
237
242
247

query IIIIII nosort
SELECT a+b*2,
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c),
       a-b
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND c>d
 ORDER BY 6,5,4,1,3,2
----
351
117
0
3
1
-3
369
122
0
4
1
-3
579
192
0
18
1
-3
666
222
0
24
1
-3
416
137
0
7
2
-1
428
142
0
8
2
-1
617
207
0
21
2
-1
544
182
0
16
3
1
391
132
0
6
4
1
560
187
0
17
1
2
635
212
0
22
3
2
723
242
0
28
4
3
514
172
0
14
2
4

query IIII nosort
SELECT a+b*2+c*3+d*4,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       e
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,1,2,4
----
1014
444
101
103
1067
333
108
109
1130
222
114
110
1226
222
122
120
1272
222
128
126
1325
333
133
132
1371
222
136
135
1411
222
140
144
1472
444
148
146
1521
333
154
152
1564
333
156
157
1622
444
164
162
1676
333
169
165
1714
444
171
173
1769
444
178
177
1828
333
183
180
1861
333
185
189
1964
333
196
197
2019
333
203
204
2069
222
207
209
2125
333
212
210
2165
222
217
219
2226
222
222
221
2264
333
226
227
2323
333
233
230
2368
444
238
237
2476
111
248
246

query IIII nosort
SELECT a+b*2+c*3,
       a+b*2,
       a-b,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE a>b
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR d>e
 ORDER BY 2,1,3,4
----
610
304
4
1529
635
317
2
1612
674
335
-1
1680
708
351
-3
1757
738
369
-3
1826
760
385
-2
1902
793
391
1
1985
827
416
-1
2046
851
428
-1
2131
880
439
4
2202
905
455
2
2281
940
475
1
2349
966
483
3
2432
1000
502
1
2501
1030
514
4
2579
1057
529
4
2654
1096
544
1
2728
1121
560
2
2806
1158
579
-3
2878
1180
595
1
2949
1207
601
1
3039
1241
617
-1
3114
1277
635
2
3175
1297
652
-2
3260
1338
666
-3
3331
1360
685
1
3399
1391
698
2
3473
1416
711
3
3553
1455
723
3
3629
1484
743
-4
3706

query III nosort
SELECT (a+b+c+d+e)/5,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>c OR e<d)
    OR b>c
 ORDER BY 2,1,3
----
102
304
0
107
317
0
112
335
0
122
369
0
127
385
0
132
391
0
137
416
0
142
428
0
147
439
0
152
455
0
157
475
0
162
483
0
167
502
0
172
514
0
177
529
0
182
544
0
187
560
0
192
579
0
197
595
0
202
601
0
207
617
0
212
635
0
217
652
0
222
666
0
227
685
0
232
698
0
237
711
0
247
743
0

query IIIIIII nosort
SELECT abs(a),
       d,
       e,
       a+b*2+c*3+d*4,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c,
       a
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 3,2,7,6,4,1,5
----
159
156
157
1564
555
3
159
168
169
165
1676
333
1
168
182
183
180
1828
333
-3
182
199
196
197
1964
555
3
199
201
203
204
2019
222
-2
201
205
207
209
2069
111
-2
205
229
226
227
2264
555
3
229

query IIIII nosort
SELECT c,
       d,
       a+b*2+c*3,
       a-b,
       e
  FROM t1
 ORDER BY 3,2,1,5,4
----
102
101
610
4
103
106
108
635
2
109
113
114
674
-1
110
119
116
708
-3
117
123
122
738
-3
120
125
128
760
-2
126
134
133
793
1
132
137
136
827
-1
135
141
140
851
-1
144
147
148
880
4
146
150
154
905
2
152
155
156
940
1
157
161
164
966
3
162
166
169
1000
1
165
172
171
1030
4
173
176
178
1057
4
177
184
183
1096
1
180
187
185
1121
2
189
193
190
1158
-3
192
195
196
1180
1
197
202
203
1207
1
204
208
207
1241
-1
209
214
212
1277
2
210
215
217
1297
-2
219
224
222
1338
-3
221
225
226
1360
1
227
231
233
1391
2
230
235
238
1416
3
237
244
241
1455
3
242
247
248
1484
-4
246

query IIIIIII nosort
SELECT c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       (a+b+c+d+e)/5,
       abs(b-c),
       a+b*2+c*3,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND (e>c OR e<d)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 6,7,2,1,3,4,5
----
-3
13
1
167
1
1000
333

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3,
       d-e
  FROM t1
 WHERE a>b
   AND c BETWEEN b-2 AND d+2
   AND (a>b-2 AND a<b+2)
 ORDER BY 2,3,4,1,5
----
167
-3
333
1000
4
202
-1
222
1207
-1
182
1
333
1096
3
132
1
444
793
1

query IIIIIII nosort
SELECT c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       a,
       abs(b-c),
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR b>c
 ORDER BY 3,5,4,2,6,7,1
----
1
444
304
104
2
1529
0
-2
333
317
107
1
1612
0
-1
222
335
111
1
1680
0
1
222
369
121
1
1826
0
-3
222
385
127
4
1902
0
1
333
391
131
4
1985
0
1
222
416
138
2
2046
0
1
222
428
142
2
2131
0
-1
444
439
149
2
2202
0
-4
333
455
153
1
2281
0
-1
333
475
159
3
2349
0
-3
444
483
163
1
2432
0
-3
333
502
168
1
2501
0
1
444
514
174
2
2579
0
-2
444
529
179
1
2654
0
1
333
544
182
3
2728
0
2
333
560
188
1
2806
0
3
222
579
191
1
2878
0
-1
333
595
199
3
2949
0
-1
333
601
201
2
3039
0
1
222
617
205
2
3114
0
2
333
635
213
3
3175
0
-2
222
652
216
3
3260
0
2
222
666
220
1
3331
0
-1
333
685
229
3
3399
0
-2
333
698
234
1
3473
0
-3
444
711
239
1
3553
0
-1
111
743
245
2
3706
0

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(a),
       a+b*2+c*3+d*4+e*5,
       d-e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d>e
    OR b>c
 ORDER BY 2,3,1,5,4,6
----
0
358
179
2654
1
444
0
364
182
2728
3
333
0
382
191
2878
-2
222
0
398
199
2949
-1
333
0
426
213
3175
2
333
0
432
216
3260
-2
222
0
440
220
3331
1
222
0
458
229
3399
-1
333
0
468
234
3473
3
333
0
478
239
3553
1
444
0
490
245
3706
2
111
0
1000
104
1529
-2
444
0
1050
107
1612
-1
333
0
1120
111
1680
4
222
0
1180
115
1757
-1
222
0
1240
121
1826
2
222
0
1290
127
1902
2
222
0
1300
131
1985
1
333
0
1390
138
2046
1
222
0
1430
142
2131
-4
222
0
1450
149
2202
2
444
0
1510
153
2281
2
333
0
1580
159
2349
-1
333
0
1600
163
2432
2
444
0
1670
168
2501
4
333

query IIIIII nosort
SELECT b-c,
       a+b*2,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 1,3,6,2,5,4
----
-1
666
220
24
2
222
1
579
191
18
3
222
2
743
245
29
-1
111

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>c OR e<d)
   AND d>e
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,2
----
358
2654
364
2728
426
3175
440
3331
468
3473
478
3553
490
3706
1120
1680
1240
1826
1290
1902
1300
1985
1390
2046
1450
2202
1510
2281
1600
2432
1670
2501

query II nosort
SELECT b,
       abs(a)
  FROM t1
 WHERE (e>a AND e<b)
    OR c BETWEEN b-2 AND d+2
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1
----
100
104
105
107
112
111
118
115
124
121
129
127
130
131
139
138
143
142
145
149
151
153
158
159
160
163
167
168
170
174
175
179
181
182
186
188
194
191
198
199
200
201
206
205
211
213
218
216
223
220
228
229
232
234
236
239
240
243
249
245

query IIIIIII nosort
SELECT a+b*2,
       a+b*2+c*3+d*4+e*5,
       b,
       c-d,
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 5,1,4,7,3,2,6
----
317
1612
105
-2
1
0
333
335
1680
112
-1
1
0
222
351
1757
118
3
1
0
222
369
1826
124
1
1
0
222
455
2281
151
-4
1
0
333
483
2432
160
-3
1
0
444
502
2501
167
-3
1
0
333
529
2654
175
-2
1
0
444
560
2806
186
2
1
0
333
579
2878
194
3
1
0
222
666
3331
223
2
1
0
222
698
3473
232
-2
1
0
333
711
3553
236
-3
1
0
444
304
1529
100
1
2
0
444
416
2046
139
1
2
0
222
428
2131
143
1
2
0
222
439
2202
145
-1
2
0
444
514
2579
170
1
2
0
444
601
3039
200
-1
2
0
333
617
3114
206
1
2
0
222
743
3706
249
-1
2
0
111
475
2349
158
-1
3
0
333
544
2728
181
1
3
0
333
595
2949
198
-1
3
0
333
635
3175
211
2
3
0
333
652
3260
218
-2
3
0
222
685
3399
228
-1
3
0
333
385
1902
129
-3
4
0
222
391
1985
130
1
4
0
333
723
3629
240
3
4
0
444

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>a AND e<b)
   AND (e>c OR e<d)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
3331

query III nosort
SELECT a+b*2+c*3+d*4,
       b,
       a-b
  FROM t1
 WHERE c>d
    OR d>e
    OR b>c
 ORDER BY 3,1,2
----
2476
249
-4
1172
118
-3
1226
124
-3
1918
194
-3
2226
223
-3
1272
129
-2
2165
218
-2
1130
112
-1
1371
139
-1
1411
143
-1
2069
206
-1
1325
130
1
1564
158
1
1676
167
1
1828
181
1
1964
198
1
2264
228
1
1521
151
2
1861
186
2
2125
211
2
2323
232
2
1622
160
3
2368
236
3
2419
240
3
1014
100
4
1472
145
4
1714
170
4
1769
175
4

query I nosort
SELECT a-b
  FROM t1
 ORDER BY 1
----
-4
-3
-3
-3
-3
-2
-2
-1
-1
-1
-1
1
1
1
1
1
1
1
2
2
2
2
2
3
3
3
4
4
4
4

query IIII nosort
SELECT e,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b
  FROM t1
 WHERE a>b
    OR c BETWEEN b-2 AND d+2
 ORDER BY 3,2,4,1
----
246
3706
111
-4
110
1680
222
-1
120
1826
222
-3
135
2046
222
-1
144
2131
222
-1
209
3114
222
-1
221
3331
222
-3
109
1612
333
2
132
1985
333
1
152
2281
333
2
157
2349
333
1
165
2501
333
1
180
2728
333
1
189
2806
333
2
197
2949
333
1
204
3039
333
1
210
3175
333
2
227
3399
333
1
230
3473
333
2
103
1529
444
4
146
2202
444
4
162
2432
444
3
173
2579
444
4
177
2654
444
4
237
3553
444
3
242
3629
444
3

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2
  FROM t1
 ORDER BY 2,4,1,5,3
----
15
358
177
444
529
16
364
180
333
544
17
376
189
333
560
18
382
192
222
579
19
398
197
333
595
20
402
204
333
601
21
410
209
222
617
22
426
210
333
635
23
432
219
222
652
24
440
221
222
666
25
458
227
333
685
26
468
230
333
698
27
478
237
444
711
28
486
242
444
723
29
490
246
111
743
0
1000
103
444
304
1
1050
109
333
317
2
1120
110
222
335
3
1180
117
222
351
4
1240
120
222
369
5
1290
126
222
385
6
1300
132
333
391
7
1390
135
222
416
8
1430
144
222
428
9
1450
146
444
439
10
1510
152
333
455
11
1580
157
333
475
12
1600
162
444
483
13
1670
165
333
502
14
1700
173
444
514

query IIIII nosort
SELECT b-c,
       c,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (a+b+c+d+e)/5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d NOT BETWEEN 110 AND 150
    OR b>c
 ORDER BY 3,5,4,2,1
----
2
141
-4
0
142
-1
187
-4
0
187
-2
102
-2
0
102
-2
172
-2
0
172
1
193
-2
0
192
-2
208
-2
0
207
3
215
-2
0
217
-1
106
-1
0
107
-1
119
-1
0
117
3
155
-1
0
157
3
195
-1
0
197
-2
202
-1
0
202
3
225
-1
0
227
-4
244
-1
0
242
2
137
1
0
137
-1
176
1
0
177
-1
224
1
0
222
1
235
1
0
237
1
123
2
0
122
4
125
2
0
127
1
150
2
0
152
-1
161
2
0
162
-3
214
2
0
212
2
247
2
0
247
-3
184
3
0
182
1
231
3
0
232
-1
113
4
0
112
1
166
4
0
167

query II nosort
SELECT b-c,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE b>c
   AND a>b
   AND (e>a AND e<b)
 ORDER BY 2,1
----

query III nosort
SELECT a+b*2,
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE b>c
   AND a>b
 ORDER BY 3,2,1
----
455
1
333
502
1
333
698
1
555
711
1
555
475
3
555
595
3
555
685
3
555

query IIIII nosort
SELECT a+b*2+c*3,
       d,
       b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND b>c
   AND c>d
 ORDER BY 3,5,1,4,2
----
827
136
2
7
-1
851
140
2
8
-1

query IIII nosort
SELECT d-e,
       (a+b+c+d+e)/5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 2,1,3,4
----
-2
102
555
101
-1
107
333
108
4
112
111
114
2
122
333
122
2
127
333
128
1
132
444
133
1
137
111
136
-4
142
111
140
2
147
555
148
2
152
333
154
-1
157
555
156
2
162
333
164
4
167
333
169
-2
172
555
171
1
177
555
178
3
182
333
183
-4
187
444
185
-1
197
555
196
-1
202
222
203
-2
207
111
207
2
212
222
212
-2
217
333
217
1
222
444
222
-1
227
555
226
3
232
555
233
1
237
555
238
2
247
444
248

query II nosort
SELECT c-d,
       e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND c>d
 ORDER BY 2,1
----
3
117
2
189
3
192
2
210
2
221
3
242

query I nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (e>a AND e<b)
   AND d>e
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
222

query II nosort
SELECT a-b,
       b-c
  FROM t1
 WHERE b>c
   AND d>e
   AND c BETWEEN b-2 AND d+2
 ORDER BY 2,1
----
-3
1
1
1
2
1
2
1
3
1
-4
2
-1
2

query III nosort
SELECT b,
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE b>c
 ORDER BY 1,2,3
----
124
122
0
129
128
0
139
136
0
143
140
0
151
154
0
158
156
0
167
169
0
194
190
0
198
196
0
218
217
0
228
226
0
232
233
0
236
238
0
249
248
0

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
1612
1680
1757
1826
1902
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2878
2949
3039
3114
3175
3260
3331
3399
3473
3553
3629
3706

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       a+b*2
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,3,2
----
358
-1
529
364
-3
544
376
-1
560
382
1
579
398
3
595
402
-2
601
410
-2
617
426
-3
635
432
3
652
440
-1
666
458
3
685
468
1
698
478
1
711
486
-4
723
490
2
743
1050
-1
317
1120
-1
335
1180
-1
351
1240
1
369
1290
4
385
1300
-4
391
1390
2
416
1430
2
428
1450
-2
439
1510
1
455
1580
3
475
1600
-1
483
1670
1
502
1700
-2
514

query I nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 1
----
358
364
376
382
398
402
410
426
432
440
458
468
478
486
490
1000
1050
1120
1180
1240
1290
1300
1390
1430
1450
1510
1580
1600
1670
1700

query II nosort
SELECT a+b*2+c*3+d*4,
       a+b*2+c*3
  FROM t1
 WHERE b>c
 ORDER BY 1,2
----
1226
738
1272
760
1371
827
1411
851
1521
905
1564
940
1676
1000
1918
1158
1964
1180
2165
1297
2264
1360
2323
1391
2368
1416
2476
1484

query IIIII nosort
SELECT e,
       a,
       a+b*2+c*3,
       b,
       d
  FROM t1
 WHERE c>d
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 4,5,1,3,2
----
103
104
610
100
101
109
107
635
105
108
110
111
674
112
114
117
115
708
118
116
120
121
738
124
122
126
127
760
129
128
132
131
793
130
133
135
138
827
139
136
144
142
851
143
140
146
149
880
145
148
152
153
905
151
154
157
159
940
158
156
162
163
966
160
164
165
168
1000
167
169
173
174
1030
170
171
177
179
1057
175
178
180
182
1096
181
183
189
188
1121
186
185
192
191
1158
194
190
197
199
1180
198
196
204
201
1207
200
203
209
205
1241
206
207
210
213
1277
211
212
219
216
1297
218
217
221
220
1338
223
222
227
229
1360
228
226
230
234
1391
232
233
237
239
1416
236
238
242
243
1455
240
241
246
245
1484
249
248

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE a>b
 ORDER BY 3,1,2
----
2654
-1
358
2728
-3
364
2806
-1
376
2949
3
398
3039
-2
402
3175
-3
426
3399
3
458
3473
1
468
3553
1
478
3629
-4
486
1529
-2
1000
1612
-1
1050
1985
-4
1300
2202
-2
1450
2281
1
1510
2349
3
1580
2432
-1
1600
2501
1
1670
2579
-2
1700

query IIIII nosort
SELECT abs(a),
       (a+b+c+d+e)/5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3,
       d-e
  FROM t1
 ORDER BY 3,1,2,5,4
----
111
112
111
674
4
138
137
111
827
1
142
142
111
851
-4
205
207
111
1241
-2
201
202
222
1207
-1
213
212
222
1277
2
243
242
222
1455
-1
107
107
333
635
-1
115
117
333
708
-1
121
122
333
738
2
127
127
333
760
2
153
152
333
905
2
163
162
333
966
2
168
167
333
1000
4
182
182
333
1096
3
216
217
333
1297
-2
131
132
444
793
1
188
187
444
1121
-4
191
192
444
1158
-2
220
222
444
1338
1
245
247
444
1484
2
104
102
555
610
-2
149
147
555
880
2
159
157
555
940
-1
174
172
555
1030
-2
179
177
555
1057
1
199
197
555
1180
-1
229
227
555
1360
-1
234
232
555
1391
3
239
237
555
1416
1

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c,
       (a+b+c+d+e)/5,
       a+b*2,
       c-d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND e+d BETWEEN a+b-10 AND c+130
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 5,3,2,4,1
----

query III nosort
SELECT c,
       a+b*2,
       abs(b-c)
  FROM t1
 WHERE b>c
    OR (a>b-2 AND a<b+2)
 ORDER BY 2,1,3
----
113
335
1
123
369
1
125
385
4
134
391
4
137
416
2
141
428
2
150
455
1
155
475
3
166
502
1
184
544
3
193
579
1
195
595
3
202
601
2
208
617
2
215
652
3
225
685
3
231
698
1
235
711
1
247
743
2

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d-e,
       a+b*2+c*3+d*4,
       c,
       a+b*2
  FROM t1
 ORDER BY 7,3,2,6,4,5,1
----
0
1
0
-2
1014
102
304
0
-2
1
-1
1067
106
317
0
-1
2
4
1130
113
335
0
3
3
-1
1172
119
351
0
1
4
2
1226
123
369
0
-3
5
2
1272
125
385
0
1
6
1
1325
134
391
0
1
7
1
1371
137
416
0
1
8
-4
1411
141
428
0
-1
9
2
1472
147
439
0
-4
10
2
1521
150
455
0
-1
11
-1
1564
155
475
0
-3
12
2
1622
161
483
0
-3
13
4
1676
166
502
0
1
14
-2
1714
172
514
0
-2
15
1
1769
176
529
0
1
16
3
1828
184
544
0
2
17
-4
1861
187
560
0
3
18
-2
1918
193
579
0
-1
19
-1
1964
195
595
0
-1
20
-1
2019
202
601
0
1
21
-2
2069
208
617
0
2
22
2
2125
214
635
0
-2
23
-2
2165
215
652
0
2
24
1
2226
224
666
0
-1
25
-1
2264
225
685
0
-2
26
3
2323
231
698
0
-3
27
1
2368
235
711
0
3
28
-1
2419
244
723
0
-1
29
2
2476
247
743

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(a),
       a-b
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 1,3,2
----
1612
107
2
1757
115
-3
1902
127
-2
2281
153
2
2432
163
3
2501
168
1
2654
179
4
2806
188
2
2878
191
-3
3175
213
2
3260
216
-2
3331
220
-3
3473
234
2
3553
239
3
3629
243
3

query I nosort
SELECT d
  FROM t1
 WHERE (e>a AND e<b)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
108
114
116
122
128
133
136
140
148
154
156
164
169
171
178
183
185
190
196
203
207
212
217
222
226
233
238
241
248

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       abs(b-c),
       c,
       a+b*2+c*3+d*4+e*5,
       abs(a),
       e
  FROM t1
 WHERE b>c
   AND d>e
 ORDER BY 4,5,6,3,2,1
----
122
1
123
1826
121
120
127
4
125
1902
127
126
137
2
137
2046
138
135
152
1
150
2281
153
152
167
1
166
2501
168
165
232
1
231
3473
234
230
237
1
235
3553
239
237
247
2
247
3706
245
246

query I nosort
SELECT a+b*2+c*3
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 1
----
610
635
674
738
793
827
851
880
905
966
1000
1030
1057
1096
1121
1207
1241
1277
1338
1391
1416
1484

query IIII nosort
SELECT abs(b-c),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       a
  FROM t1
 WHERE b>c
   AND d>e
 ORDER BY 4,1,3,2
----
1
1240
124
121
4
1290
129
127
2
1390
139
138
1
1510
151
153
1
1670
167
168
1
468
232
234
1
478
236
239
2
490
249
245

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       a,
       abs(a),
       c-d,
       c
  FROM t1
 ORDER BY 2,5,4,6,3,1
----
1014
102
104
104
1
102
1067
107
107
107
-2
106
1130
112
111
111
-1
113
1172
117
115
115
3
119
1226
122
121
121
1
123
1272
127
127
127
-3
125
1325
132
131
131
1
134
1371
137
138
138
1
137
1411
142
142
142
1
141
1472
147
149
149
-1
147
1521
152
153
153
-4
150
1564
157
159
159
-1
155
1622
162
163
163
-3
161
1676
167
168
168
-3
166
1714
172
174
174
1
172
1769
177
179
179
-2
176
1828
182
182
182
1
184
1861
187
188
188
2
187
1918
192
191
191
3
193
1964
197
199
199
-1
195
2019
202
201
201
-1
202
2069
207
205
205
1
208
2125
212
213
213
2
214
2165
217
216
216
-2
215
2226
222
220
220
2
224
2264
227
229
229
-1
225
2323
232
234
234
-2
231
2368
237
239
239
-3
235
2419
242
243
243
3
244
2476
247
245
245
-1
247

query II nosort
SELECT d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1,2
----
-4
0
-2
0
-1
0
-1
0
-1
0
-1
0
1
0
1
0
3
0
4
0
4
0

query III nosort
SELECT abs(b-c),
       b,
       e
  FROM t1
 WHERE a>b
 ORDER BY 1,3,2
----
1
105
109
1
151
152
1
160
162
1
167
165
1
175
177
1
186
189
1
232
230
1
236
237
2
100
103
2
145
146
2
170
173
2
200
204
3
158
157
3
181
180
3
198
197
3
211
210
3
228
227
4
130
132
4
240
242

query IIIII nosort
SELECT abs(a),
       a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c),
       d-e
  FROM t1
 ORDER BY 3,1,4,5,2
----
179
4
358
1
1
182
1
364
3
3
188
2
376
1
-4
191
-3
382
1
-2
199
1
398
3
-1
201
1
402
2
-1
205
-1
410
2
-2
213
2
426
3
2
216
-2
432
3
-2
220
-3
440
1
1
229
1
458
3
-1
234
2
468
1
3
239
3
478
1
1
243
3
486
4
-1
245
-4
490
2
2
104
4
1000
2
-2
107
2
1050
1
-1
111
-1
1120
1
4
115
-3
1180
1
-1
121
-3
1240
1
2
127
-2
1290
4
2
131
1
1300
4
1
138
-1
1390
2
1
142
-1
1430
2
-4
149
4
1450
2
2
153
2
1510
1
2
159
1
1580
3
-1
163
3
1600
1
2
168
1
1670
1
4
174
4
1700
2
-2

query II nosort
SELECT abs(b-c),
       e
  FROM t1
 WHERE c>d
 ORDER BY 1,2
----
1
117
1
120
1
189
1
192
1
221
2
103
2
135
2
144
2
173
2
209
3
180
3
210
4
132
4
242

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d
  FROM t1
 ORDER BY 1,2
----
0
101
0
108
0
114
0
116
0
122
0
128
0
133
0
136
0
140
0
148
0
154
0
156
0
164
0
169
0
171
0
178
0
183
0
185
0
190
0
196
0
203
0
207
0
212
0
217
0
222
0
226
0
233
0
238
0
241
0
248

query IIIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4+e*5,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d
  FROM t1
 WHERE a>b
   AND (e>a AND e<b)
 ORDER BY 7,2,4,6,1,3,5
----

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
1612
1680
1757
1826
1902
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2878
2949
3039
3114
3175
3260
3331
3399
3473
3553
3629
3706

query II nosort
SELECT b,
       e
  FROM t1
 WHERE d>e
    OR (a>b-2 AND a<b+2)
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,1
----
100
103
105
109
112
110
118
117
124
120
129
126
130
132
139
135
143
144
145
146
151
152
158
157
160
162
167
165
175
177
181
180
198
197
200
204
206
209
211
210
223
221
228
227
232
230
236
237
249
246

query II nosort
SELECT a+b*2+c*3,
       a+b*2
  FROM t1
 WHERE a>b
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 2,1
----
610
304
635
317
905
455
940
475
966
483
1000
502
1030
514
1057
529
1096
544
1121
560
1180
595
1207
601
1277
635
1360
685
1391
698
1416
711
1455
723

query III nosort
SELECT (a+b+c+d+e)/5,
       d,
       a+b*2+c*3+d*4
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 3,2,1
----
107
108
1067
152
154
1521
157
156
1564
162
164
1622
167
169
1676
172
171
1714
177
178
1769
182
183
1828
187
185
1861
192
190
1918
197
196
1964
202
203
2019
207
207
2069
212
212
2125
217
217
2165
222
222
2226
227
226
2264
232
233
2323
237
238
2368
242
241
2419
247
248
2476

query II nosort
SELECT abs(b-c),
       c-d
  FROM t1
 ORDER BY 1,2
----
1
-4
1
-3
1
-3
1
-3
1
-2
1
-2
1
-2
1
-1
1
1
1
2
1
2
1
3
1
3
2
-1
2
-1
2
-1
2
1
2
1
2
1
2
1
2
1
3
-2
3
-1
3
-1
3
-1
3
1
3
2
4
-3
4
1
4
3

query IIII nosort
SELECT a+b*2+c*3+d*4,
       a+b*2+c*3+d*4+e*5,
       a,
       a+b*2
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR a>b
    OR b>c
 ORDER BY 3,1,2,4
----
1014
1529
104
304
1067
1612
107
317
1172
1757
115
351
1226
1826
121
369
1272
1902
127
385
1325
1985
131
391
1371
2046
138
416
1411
2131
142
428
1472
2202
149
439
1521
2281
153
455
1564
2349
159
475
1622
2432
163
483
1676
2501
168
502
1714
2579
174
514
1769
2654
179
529
1828
2728
182
544
1861
2806
188
560
1918
2878
191
579
1964
2949
199
595
2019
3039
201
601
2125
3175
213
635
2165
3260
216
652
2226
3331
220
666
2264
3399
229
685
2323
3473
234
698
2368
3553
239
711
2419
3629
243
723
2476
3706
245
743

query IIIIII nosort
SELECT a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5,
       d,
       a+b*2+c*3
  FROM t1
 WHERE b>c
   AND (c<=d-2 OR c>=d+2)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,3,1,6,4,5
----
127
333
0
1902
128
760
153
333
0
2281
154
905
168
333
0
2501
169
1000
216
333
0
3260
217
1297
191
444
0
2878
190
1158
234
555
0
3473
233
1391
239
555
0
3553
238
1416

query III nosort
SELECT c,
       b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 1,2,3
----
102
100
444
106
105
333
113
112
222
119
118
222
123
124
222
125
129
222
134
130
333
137
139
222
141
143
222
147
145
444
150
151
333
155
158
333
161
160
444
166
167
333
172
170
444
176
175
444
184
181
333
187
186
333
193
194
222
195
198
333
202
200
333
208
206
222
214
211
333
215
218
222
224
223
222
225
228
333
231
232
333
235
236
444
244
240
444
247
249
111

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5,
       c-d,
       d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,3,4,2
----
0
2281
-4
154
0
2432
-3
164
0
2501
-3
169
0
3553
-3
238
0
1612
-2
108
0
2654
-2
178
0
3260
-2
217
0
3473
-2
233
0
2349
-1
156
0
2949
-1
196
0
3039
-1
203
0
3399
-1
226
0
3706
-1
248
0
1529
1
101
0
2579
1
171
0
2728
1
183
0
3114
1
207
0
2806
2
185
0
3175
2
212
0
3331
2
222
0
2878
3
190
0
3629
3
241

query I nosort
SELECT b
  FROM t1
 ORDER BY 1
----
100
105
112
118
124
129
130
139
143
145
151
158
160
167
170
175
181
186
194
198
200
206
211
218
223
228
232
236
240
249

query I nosort
SELECT a+b*2+c*3
  FROM t1
 ORDER BY 1
----
610
635
674
708
738
760
793
827
851
880
905
940
966
1000
1030
1057
1096
1121
1158
1180
1207
1241
1277
1297
1338
1360
1391
1416
1455
1484

query II nosort
SELECT abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d NOT BETWEEN 110 AND 150
   AND (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
205
222
168
333
182
333
201
333

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2,
       a+b*2+c*3+d*4+e*5,
       a,
       d-e
  FROM t1
 WHERE d>e
   AND (e>a AND e<b)
   AND b>c
 ORDER BY 1,5,3,4,2
----
247
743
3706
245
2

query I nosort
SELECT a+b*2+c*3
  FROM t1
 WHERE b>c
    OR a>b
    OR (e>a AND e<b)
 ORDER BY 1
----
610
635
708
738
760
793
827
851
880
905
940
966
1000
1030
1057
1096
1121
1158
1180
1207
1277
1297
1338
1360
1391
1416
1455
1484

query III nosort
SELECT a+b*2+c*3,
       e,
       a-b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND b>c
 ORDER BY 1,3,2
----
738
120
-3
827
135
-1
851
144
-1
905
152
2
1000
165
1
1391
230
2
1416
237
3
1484
246
-4

query IIII nosort
SELECT d-e,
       a,
       b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 3,1,2,4
----
-2
104
100
555
-1
107
105
333
4
111
112
111
-1
115
118
333
2
121
124
333
2
127
129
333
1
131
130
444
1
138
139
111
-4
142
143
111
2
149
145
555
2
153
151
333
-1
159
158
555
2
163
160
333
4
168
167
333
-2
174
170
555
1
179
175
555
3
182
181
333
-4
188
186
444
-2
191
194
444
-1
199
198
555
-1
201
200
222
-2
205
206
111
2
213
211
222
-2
216
218
333
1
220
223
444
-1
229
228
555
3
234
232
555
1
239
236
555
-1
243
240
222
2
245
249
444

query IIIIII nosort
SELECT b,
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       a+b*2+c*3+d*4+e*5,
       a+b*2
  FROM t1
 WHERE d>e
   AND c>d
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 6,5,2,1,3,4
----
124
122
333
1
1826
369
130
133
444
4
1985
391
139
136
111
2
2046
416
181
183
333
3
2728
544
211
212
222
3
3175
635
223
222
444
1
3331
666

query II nosort
SELECT (a+b+c+d+e)/5,
       a+b*2+c*3
  FROM t1
 WHERE b>c
    OR d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
 ORDER BY 2,1
----
102
610
107
635
112
674
122
738
127
760
132
793
137
827
142
851
147
880
152
905
157
940
162
966
167
1000
172
1030
177
1057
182
1096
187
1121
192
1158
197
1180
202
1207
207
1241
212
1277
217
1297
222
1338
227
1360
232
1391
237
1416
242
1455
247
1484

query IIII nosort
SELECT a+b*2+c*3,
       c-d,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE d>e
    OR (c<=d-2 OR c>=d+2)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1,2,4,3
----
610
1
1529
0
635
-2
1612
0
674
-1
1680
0
708
3
1757
0
738
1
1826
0
760
-3
1902
0
793
1
1985
0
827
1
2046
0
851
1
2131
0
880
-1
2202
0
905
-4
2281
0
966
-3
2432
0
1000
-3
2501
0
1030
1
2579
0
1057
-2
2654
0
1096
1
2728
0
1121
2
2806
0
1158
3
2878
0
1207
-1
3039
0
1241
1
3114
0
1277
2
3175
0
1297
-2
3260
0
1338
2
3331
0
1391
-2
3473
0
1416
-3
3553
0
1455
3
3629
0
1484
-1
3706
0

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a-b,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 3,5,1,2,7,4,6
----
112
111
111
-1
111
0
1680
137
138
111
-1
138
0
2046
142
142
111
-1
142
0
2131
207
205
111
-1
205
0
3114
202
201
222
1
201
0
3039
212
213
222
2
213
0
3175
242
243
222
3
243
0
3629
107
107
333
2
107
0
1612
117
115
333
-3
115
0
1757
122
121
333
-3
121
0
1826
127
127
333
-2
127
0
1902
152
153
333
2
153
0
2281
162
163
333
3
163
0
2432
167
168
333
1
168
0
2501
182
182
333
1
182
0
2728
217
216
333
-2
216
0
3260
132
131
444
1
131
0
1985
187
188
444
2
188
0
2806
192
191
444
-3
191
0
2878
222
220
444
-3
220
0
3331
247
245
444
-4
245
0
3706
102
104
555
4
104
0
1529
147
149
555
4
149
0
2202
157
159
555
1
159
0
2349
172
174
555
4
174
0
2579
177
179
555
4
179
0
2654
197
199
555
1
199
0
2949
227
229
555
1
229
0
3399
232
234
555
2
234
0
3473
237
239
555
3
239
0
3553

query IIIII nosort
SELECT a,
       abs(a),
       d,
       (a+b+c+d+e)/5,
       c-d
  FROM t1
 WHERE d>e
   AND (e>c OR e<d)
 ORDER BY 2,1,3,5,4
----
111
111
114
112
-1
121
121
122
122
1
127
127
128
127
-3
131
131
133
132
1
138
138
136
137
1
149
149
148
147
-1
153
153
154
152
-4
163
163
164
162
-3
168
168
169
167
-3
179
179
178
177
-2
182
182
183
182
1
213
213
212
212
2
220
220
222
222
2
234
234
233
232
-2
239
239
238
237
-3
245
245
248
247
-1

query IIIII nosort
SELECT a+b*2+c*3,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 1,5,3,2,4
----
635
333
106
1050
108
708
222
119
1180
116
760
222
125
1290
128
905
333
150
1510
154
966
444
161
1600
164
1000
333
166
1670
169
1057
444
176
358
178
1121
333
187
376
185
1158
222
193
382
190
1277
333
214
426
212
1297
222
215
432
217
1338
222
224
440
222
1391
333
231
468
233
1416
444
235
478
238
1455
444
244
486
241

query IIIIIII nosort
SELECT c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND d>e
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 7,2,1,5,6,4,3
----
166
333
502
165
0
1
333
184
333
544
180
0
-3
333

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE a>b
 ORDER BY 7,6,5,2,1,3,4
----
0
177
15
177
444
178
358
0
180
16
182
333
183
364
0
189
17
187
333
185
376
0
197
19
197
333
196
398
0
204
20
202
333
203
402
0
210
22
212
333
212
426
0
227
25
227
333
226
458
0
230
26
232
333
233
468
0
237
27
237
444
238
478
0
242
28
242
444
241
486
0
103
0
102
444
101
1000
0
109
1
107
333
108
1050
0
132
6
132
333
133
1300
0
146
9
147
444
148
1450
0
152
10
152
333
154
1510
0
157
11
157
333
156
1580
0
162
12
162
444
164
1600
0
165
13
167
333
169
1670
0
173
14
172
444
171
1700

query IIIIII nosort
SELECT e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE a>b
   AND (c<=d-2 OR c>=d+2)
   AND c>d
 ORDER BY 6,5,4,2,3,1
----
210
22
426
222
2
0
189
17
376
444
2
0
242
28
486
222
3
0

query III nosort
SELECT c,
       a+b*2,
       e
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,3
----
102
304
103
106
317
109
113
335
110
119
351
117
123
369
120
125
385
126
150
455
152
155
475
157
161
483
162
166
502
165
172
514
173
176
529
177
184
544
180
187
560
189
193
579
192
195
595
197
202
601
204
208
617
209
214
635
210
215
652
219
224
666
221
225
685
227
231
698
230
235
711
237
244
723
242
247
743
246

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       b,
       b-c,
       e,
       a
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (e>a AND e<b)
   AND (a>b-2 AND a<b+2)
 ORDER BY 3,2,1,6,5,4
----

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4,
       c
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 1,3,2
----
358
1769
176
376
1861
187
382
1918
193
426
2125
214
432
2165
215
440
2226
224
468
2323
231
478
2368
235
486
2419
244
1000
1014
102
1050
1067
106
1120
1130
113
1180
1172
119
1240
1226
123
1290
1272
125
1510
1521
150
1600
1622
161
1670
1676
166

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d
  FROM t1
 ORDER BY 2,3,1
----
15
358
-2
16
364
1
17
376
2
18
382
3
19
398
-1
20
402
-1
21
410
1
22
426
2
23
432
-2
24
440
2
25
458
-1
26
468
-2
27
478
-3
28
486
3
29
490
-1
0
1000
1
1
1050
-2
2
1120
-1
3
1180
3
4
1240
1
5
1290
-3
6
1300
1
7
1390
1
8
1430
1
9
1450
-1
10
1510
-4
11
1580
-1
12
1600
-3
13
1670
-3
14
1700
1

query IIII nosort
SELECT d-e,
       abs(b-c),
       (a+b+c+d+e)/5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND (e>a AND e<b)
   AND a>b
 ORDER BY 3,4,1,2
----

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3,
       b-c,
       d-e
  FROM t1
 ORDER BY 1,2,3,4
----
111
674
-1
4
111
827
2
1
111
851
2
-4
111
1241
-2
-2
222
1207
-2
-1
222
1277
-3
2
222
1455
-4
-1
333
635
-1
-1
333
708
-1
-1
333
738
1
2
333
760
4
2
333
905
1
2
333
966
-1
2
333
1000
1
4
333
1096
-3
3
333
1297
3
-2
444
793
-4
1
444
1121
-1
-4
444
1158
1
-2
444
1338
-1
1
444
1484
2
2
555
610
-2
-2
555
880
-2
2
555
940
3
-1
555
1030
-2
-2
555
1057
-1
1
555
1180
3
-1
555
1360
3
-1
555
1391
1
3
555
1416
1
1

query II nosort
SELECT d,
       a+b*2+c*3
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,1
----
101
610
108
635
114
674
116
708
122
738
128
760

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       d,
       a+b*2+c*3+d*4,
       c,
       d-e,
       a+b*2
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (a>b-2 AND a<b+2)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 4,6,2,5,1,3
----
2501
169
1676
166
4
502
2728
183
1828
184
3
544
3039
203
2019
202
-1
601
3114
207
2069
208
-2
617

query IIIIIII nosort
SELECT abs(a),
       abs(b-c),
       c,
       a-b,
       c-d,
       a+b*2+c*3+d*4,
       b
  FROM t1
 ORDER BY 2,6,7,4,1,5,3
----
107
1
106
2
-2
1067
105
111
1
113
-1
-1
1130
112
115
1
119
-3
3
1172
118
121
1
123
-3
1
1226
124
153
1
150
2
-4
1521
151
163
1
161
3
-3
1622
160
168
1
166
1
-3
1676
167
179
1
176
4
-2
1769
175
188
1
187
2
2
1861
186
191
1
193
-3
3
1918
194
220
1
224
-3
2
2226
223
234
1
231
2
-2
2323
232
239
1
235
3
-3
2368
236
104
2
102
4
1
1014
100
138
2
137
-1
1
1371
139
142
2
141
-1
1
1411
143
149
2
147
4
-1
1472
145
174
2
172
4
1
1714
170
201
2
202
1
-1
2019
200
205
2
208
-1
1
2069
206
245
2
247
-4
-1
2476
249
159
3
155
1
-1
1564
158
182
3
184
1
1
1828
181
199
3
195
1
-1
1964
198
213
3
214
2
2
2125
211
216
3
215
-2
-2
2165
218
229
3
225
1
-1
2264
228
127
4
125
-2
-3
1272
129
131
4
134
1
1
1325
130
243
4
244
3
3
2419
240

query III nosort
SELECT b,
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (e>c OR e<d)
    OR e+d BETWEEN a+b-10 AND c+130
    OR a>b
 ORDER BY 3,2,1
----
112
114
111
139
136
111
143
140
111
206
207
111
200
203
222
211
212
222
240
241
222
105
108
333
118
116
333
124
122
333
129
128
333
151
154
333
160
164
333
167
169
333
181
183
333
218
217
333
130
133
444
186
185
444
223
222
444
249
248
444
100
101
555
145
148
555
158
156
555
170
171
555
175
178
555
198
196
555
228
226
555
232
233
555
236
238
555

query IIII nosort
SELECT a-b,
       a+b*2+c*3+d*4,
       d,
       e
  FROM t1
 ORDER BY 2,4,1,3
----
4
1014
101
103
2
1067
108
109
-1
1130
114
110
-3
1172
116
117
-3
1226
122
120
-2
1272
128
126
1
1325
133
132
-1
1371
136
135
-1
1411
140
144
4
1472
148
146
2
1521
154
152
1
1564
156
157
3
1622
164
162
1
1676
169
165
4
1714
171
173
4
1769
178
177
1
1828
183
180
2
1861
185
189
-3
1918
190
192
1
1964
196
197
1
2019
203
204
-1
2069
207
209
2
2125
212
210
-2
2165
217
219
-3
2226
222
221
1
2264
226
227
2
2323
233
230
3
2368
238
237
3
2419
241
242
-4
2476
248
246

query IIIIIII nosort
SELECT a+b*2,
       c-d,
       d-e,
       abs(a),
       a-b,
       c,
       b
  FROM t1
 WHERE a>b
 ORDER BY 3,2,1,4,7,5,6
----
560
2
-4
188
2
187
186
304
1
-2
104
4
102
100
514
1
-2
174
4
172
170
317
-2
-1
107
2
106
105
475
-1
-1
159
1
155
158
595
-1
-1
199
1
195
198
601
-1
-1
201
1
202
200
685
-1
-1
229
1
225
228
723
3
-1
243
3
244
240
711
-3
1
239
3
235
236
529
-2
1
179
4
176
175
391
1
1
131
1
134
130
455
-4
2
153
2
150
151
483
-3
2
163
3
161
160
439
-1
2
149
4
147
145
635
2
2
213
2
214
211
698
-2
3
234
2
231
232
544
1
3
182
1
184
181
502
-3
4
168
1
166
167

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e,
       a+b*2+c*3+d*4,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       abs(a),
       c-d
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
 ORDER BY 1,4,2,5,7,3,6
----
0
246
2476
111
1484
245
-1
0
110
1130
222
674
111
-1
0
120
1226
222
738
121
1
0
126
1272
222
760
127
-3
0
135
1371
222
827
138
1
0
144
1411
222
851
142
1
0
209
2069
222
1241
205
1
0
219
2165
222
1297
216
-2
0
221
2226
222
1338
220
2
0
109
1067
333
635
107
-2
0
132
1325
333
793
131
1
0
152
1521
333
905
153
-4
0
157
1564
333
940
159
-1
0
165
1676
333
1000
168
-3
0
180
1828
333
1096
182
1
0
189
1861
333
1121
188
2
0
197
1964
333
1180
199
-1
0
204
2019
333
1207
201
-1
0
210
2125
333
1277
213
2
0
227
2264
333
1360
229
-1
0
230
2323
333
1391
234
-2
0
103
1014
444
610
104
1
0
146
1472
444
880
149
-1
0
162
1622
444
966
163
-3
0
173
1714
444
1030
174
1
0
177
1769
444
1057
179
-2
0
237
2368
444
1416
239
-3

query IIIIII nosort
SELECT d,
       (a+b+c+d+e)/5,
       a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       d-e,
       c
  FROM t1
 WHERE d>e
    OR (e>a AND e<b)
    OR (e>c OR e<d)
 ORDER BY 2,3,1,4,5,6
----
101
102
610
1529
-2
102
108
107
635
1612
-1
106
114
112
674
1680
4
113
116
117
708
1757
-1
119
122
122
738
1826
2
123
128
127
760
1902
2
125
133
132
793
1985
1
134
136
137
827
2046
1
137
140
142
851
2131
-4
141
148
147
880
2202
2
147
154
152
905
2281
2
150
156
157
940
2349
-1
155
164
162
966
2432
2
161
169
167
1000
2501
4
166
171
172
1030
2579
-2
172
178
177
1057
2654
1
176
183
182
1096
2728
3
184
185
187
1121
2806
-4
187
190
192
1158
2878
-2
193
196
197
1180
2949
-1
195
203
202
1207
3039
-1
202
207
207
1241
3114
-2
208
212
212
1277
3175
2
214
217
217
1297
3260
-2
215
222
222
1338
3331
1
224
226
227
1360
3399
-1
225
233
232
1391
3473
3
231
238
237
1416
3553
1
235
248
247
1484
3706
2
247

query I nosort
SELECT d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1
----
101
108
114
122
133
136
140
148
154
156
164
169
171
178
183
185
190
196
203
207
212
217
222
226
233
238
241
248

query IIII nosort
SELECT a+b*2,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,3,2,4
----
304
102
1000
101
317
106
1050
108
455
150
1510
154
475
155
1580
156
483
161
1600
164
502
166
1670
169
514
172
1700
171
529
176
358
178
544
184
364
183
560
187
376
185
579
193
382
190
595
195
398
196
601
202
402
203
617
208
410
207
635
214
426
212
652
215
432
217
666
224
440
222
685
225
458
226
698
231
468
233
711
235
478
238
723
244
486
241
743
247
490
248

query IIIII nosort
SELECT a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b,
       c,
       abs(a)
  FROM t1
 WHERE d>e
 ORDER BY 1,3,2,4,5
----
335
0
112
113
111
369
0
124
123
121
385
0
129
125
127
391
0
130
134
131
416
0
139
137
138
439
0
145
147
149
455
0
151
150
153
483
0
160
161
163
502
0
167
166
168
529
0
175
176
179
544
0
181
184
182
635
0
211
214
213
666
0
223
224
220
698
0
232
231
234
711
0
236
235
239
743
0
249
247
245

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       c-d
  FROM t1
 ORDER BY 4,1,2,3,5
----
1000
1014
555
1529
1
1050
1067
333
1612
-2
1120
1130
111
1680
-1
1180
1172
333
1757
3
1240
1226
333
1826
1
1290
1272
333
1902
-3
1300
1325
444
1985
1
1390
1371
111
2046
1
1430
1411
111
2131
1
1450
1472
555
2202
-1
1510
1521
333
2281
-4
1580
1564
555
2349
-1
1600
1622
333
2432
-3
1670
1676
333
2501
-3
1700
1714
555
2579
1
358
1769
555
2654
-2
364
1828
333
2728
1
376
1861
444
2806
2
382
1918
444
2878
3
398
1964
555
2949
-1
402
2019
222
3039
-1
410
2069
111
3114
1
426
2125
222
3175
2
432
2165
333
3260
-2
440
2226
444
3331
2
458
2264
555
3399
-1
468
2323
555
3473
-2
478
2368
555
3553
-3
486
2419
222
3629
3
490
2476
444
3706
-1

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e,
       a+b*2+c*3,
       c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR d>e
 ORDER BY 3,4,2,5,1
----
333
0
109
635
106
111
0
110
674
113
333
0
117
708
119
333
0
120
738
123
333
0
126
760
125
444
0
132
793
134
111
0
135
827
137
555
0
146
880
147
333
0
152
905
150
333
0
162
966
161
333
0
165
1000
166
555
0
177
1057
176
333
0
180
1096
184
444
0
189
1121
187
444
0
192
1158
193
222
0
210
1277
214
333
0
219
1297
215
444
0
221
1338
224
555
0
230
1391
231
555
0
237
1416
235
222
0
242
1455
244
444
0
246
1484
247

query I nosort
SELECT abs(a)
  FROM t1
 ORDER BY 1
----
104
107
111
115
121
127
131
138
142
149
153
159
163
168
174
179
182
188
191
199
201
205
213
216
220
229
234
239
243
245

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       d,
       a-b,
       abs(a),
       c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 5,2,1,4,6,3
----
1014
101
4
104
102
444
1067
108
2
107
106
333
1130
114
-1
111
113
222
1226
122
-3
121
123
222
1325
133
1
131
134
333
1371
136
-1
138
137
222
1411
140
-1
142
141
222
1472
148
4
149
147
444
1521
154
2
153
150
333
1622
164
3
163
161
444
1676
169
1
168
166
333
1714
171
4
174
172
444
1769
178
4
179
176
444
1828
183
1
182
184
333
1861
185
2
188
187
333
2019
203
1
201
202
333
2069
207
-1
205
208
222
2125
212
2
213
214
333
2226
222
-3
220
224
222
2323
233
2
234
231
333
2368
238
3
239
235
444
2476
248
-4
245
247
111

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a),
       a-b,
       a+b*2+c*3,
       d-e,
       b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1,5,6,2,4,7,3
----
0
188
2
1121
-4
186
333
0
191
-3
1158
-2
194
222
0
216
-2
1297
-2
218
222
0
107
2
635
-1
105
333
0
243
3
1455
-1
240
444
0
179
4
1057
1
175
444
0
220
-3
1338
1
223
222
0
239
3
1416
1
236
444
0
153
2
905
2
151
333
0
163
3
966
2
160
444
0
213
2
1277
2
211
333
0
234
2
1391
3
232
333
0
168
1
1000
4
167
333

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c,
       a
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (e>a AND e<b)
   AND a>b
 ORDER BY 2,4,6,5,1,3
----

query IIII nosort
SELECT a+b*2+c*3+d*4,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c>d
 ORDER BY 4,1,3,2
----
1014
444
104
0
1172
222
115
0
1226
222
121
0
1325
333
131
0
1371
222
138
0
1411
222
142
0
1714
444
174
0
1828
333
182
0
1861
333
188
0
1918
222
191
0
2069
222
205
0
2125
333
213
0
2226
222
220
0
2419
444
243
0

query I nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1
----
111
222
222
222
222
333
333
333
333
333
333
333
333
333
333
333
444
444
444
444
444
444

query IIIIIII nosort
SELECT b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       b-c,
       a+b*2+c*3+d*4,
       c,
       abs(a)
  FROM t1
 WHERE d>e
 ORDER BY 2,1,4,5,6,3,7
----
112
0
-1
-1
1130
113
111
124
0
1
1
1226
123
121
129
0
-3
4
1272
125
127
130
0
1
-4
1325
134
131
139
0
1
2
1371
137
138
145
0
-1
-2
1472
147
149
151
0
-4
1
1521
150
153
160
0
-3
-1
1622
161
163
167
0
-3
1
1676
166
168
175
0
-2
-1
1769
176
179
181
0
1
-3
1828
184
182
211
0
2
-3
2125
214
213
223
0
2
-1
2226
224
220
232
0
-2
1
2323
231
234
236
0
-3
1
2368
235
239
249
0
-1
2
2476
247
245

query IIIIII nosort
SELECT b,
       a+b*2+c*3+d*4,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       abs(b-c),
       abs(a)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 5,4,2,1,3,6
----
118
1172
222
115
1
115
194
1918
222
191
1
191
223
2226
222
220
1
220
249
2476
111
245
2
245

query IIIIIII nosort
SELECT d,
       a,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c,
       (a+b+c+d+e)/5,
       e
  FROM t1
 WHERE (e>c OR e<d)
    OR (a>b-2 AND a<b+2)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 3,5,1,4,7,6,2
----
108
107
1
333
-1
107
109
114
111
1
111
-1
112
110
116
115
1
333
-1
117
117
164
163
1
333
-1
162
162
178
179
1
555
-1
177
177
185
188
1
444
-1
187
189
222
220
1
444
-1
222
221
122
121
1
333
1
122
120
154
153
1
333
1
152
152
169
168
1
333
1
167
165
190
191
1
444
1
192
192
233
234
1
555
1
232
230
238
239
1
555
1
237
237
101
104
2
555
-2
102
103
148
149
2
555
-2
147
146
171
174
2
555
-2
172
173
203
201
2
222
-2
202
204
207
205
2
111
-2
207
209
136
138
2
111
2
137
135
140
142
2
111
2
142
144
248
245
2
444
2
247
246
183
182
3
333
-3
182
180
212
213
3
222
-3
212
210
156
159
3
555
3
157
157
196
199
3
555
3
197
197
217
216
3
333
3
217
219
226
229
3
555
3
227
227
133
131
4
444
-4
132
132
241
243
4
222
-4
242
242
128
127
4
333
4
127
126

query III nosort
SELECT a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b
  FROM t1
 ORDER BY 1,3,2
----
-4
490
249
-3
1180
118
-3
1240
124
-3
382
194
-3
440
223
-2
1290
129
-2
432
218
-1
1120
112
-1
1390
139
-1
1430
143
-1
410
206
1
1300
130
1
1580
158
1
1670
167
1
364
181
1
398
198
1
402
200
1
458
228
2
1050
105
2
1510
151
2
376
186
2
426
211
2
468
232
3
1600
160
3
478
236
3
486
240
4
1000
100
4
1450
145
4
1700
170
4
358
175

query IIIIIII nosort
SELECT b,
       a-b,
       c,
       abs(b-c),
       d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,6,4,5,2,7,3
----
105
2
106
1
-1
1050
-1
112
-1
113
1
4
1120
-1
118
-3
119
1
-1
1180
-1
124
-3
123
1
2
1240
1
129
-2
125
4
2
1290
4
130
1
134
4
1
1300
-4
139
-1
137
2
1
1390
2
143
-1
141
2
-4
1430
2
145
4
147
2
2
1450
-2
151
2
150
1
2
1510
1
158
1
155
3
-1
1580
3
160
3
161
1
2
1600
-1
167
1
166
1
4
1670
1
170
4
172
2
-2
1700
-2
175
4
176
1
1
358
-1
181
1
184
3
3
364
-3
186
2
187
1
-4
376
-1
194
-3
193
1
-2
382
1
198
1
195
3
-1
398
3
200
1
202
2
-1
402
-2
206
-1
208
2
-2
410
-2
211
2
214
3
2
426
-3
218
-2
215
3
-2
432
3
223
-3
224
1
1
440
-1
228
1
225
3
-1
458
3
232
2
231
1
3
468
1
236
3
235
1
1
478
1
240
3
244
4
-1
486
-4
249
-4
247
2
2
490
2

query IIIIIII nosort
SELECT c-d,
       a+b*2+c*3+d*4,
       a,
       abs(b-c),
       abs(a),
       (a+b+c+d+e)/5,
       c
  FROM t1
 ORDER BY 2,4,5,6,3,7,1
----
1
1014
104
2
104
102
102
-2
1067
107
1
107
107
106
-1
1130
111
1
111
112
113
3
1172
115
1
115
117
119
1
1226
121
1
121
122
123
-3
1272
127
4
127
127
125
1
1325
131
4
131
132
134
1
1371
138
2
138
137
137
1
1411
142
2
142
142
141
-1
1472
149
2
149
147
147
-4
1521
153
1
153
152
150
-1
1564
159
3
159
157
155
-3
1622
163
1
163
162
161
-3
1676
168
1
168
167
166
1
1714
174
2
174
172
172
-2
1769
179
1
179
177
176
1
1828
182
3
182
182
184
2
1861
188
1
188
187
187
3
1918
191
1
191
192
193
-1
1964
199
3
199
197
195
-1
2019
201
2
201
202
202
1
2069
205
2
205
207
208
2
2125
213
3
213
212
214
-2
2165
216
3
216
217
215
2
2226
220
1
220
222
224
-1
2264
229
3
229
227
225
-2
2323
234
1
234
232
231
-3
2368
239
1
239
237
235
3
2419
243
4
243
242
244
-1
2476
245
2
245
247
247

query IIIIIII nosort
SELECT c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(a),
       e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       a-b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (e>a AND e<b)
 ORDER BY 7,4,1,2,6,5,3
----
247
29
245
246
111
248
-4
119
3
115
117
222
116
-3
123
4
121
120
222
122
-3
193
18
191
192
222
190
-3
224
24
220
221
222
222
-3
113
2
111
110
222
114
-1
137
7
138
135
222
136
-1
141
8
142
144
222
140
-1
208
21
205
209
222
207
-1
134
6
131
132
333
133
1
166
13
168
165
333
169
1
184
16
182
180
333
183
1
202
20
201
204
333
203
1
106
1
107
109
333
108
2
150
10
153
152
333
154
2
187
17
188
189
333
185
2
214
22
213
210
333
212
2
231
26
234
230
333
233
2
161
12
163
162
444
164
3
235
27
239
237
444
238
3
102
0
104
103
444
101
4
147
9
149
146
444
148
4
172
14
174
173
444
171
4
176
15
179
177
444
178
4

query IIIIII nosort
SELECT a+b*2,
       b,
       d-e,
       a,
       abs(b-c),
       d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,5,4,3,6
----
304
100
-2
104
2
101
317
105
-1
107
1
108
455
151
2
153
1
154
475
158
-1
159
3
156
483
160
2
163
1
164
502
167
4
168
1
169
514
170
-2
174
2
171
529
175
1
179
1
178
544
181
3
182
3
183
560
186
-4
188
1
185
579
194
-2
191
1
190
595
198
-1
199
3
196
601
200
-1
201
2
203
617
206
-2
205
2
207
635
211
2
213
3
212
652
218
-2
216
3
217
666
223
1
220
1
222
685
228
-1
229
3
226
698
232
3
234
1
233
711
236
1
239
1
238
723
240
-1
243
4
241
743
249
2
245
2
248

query I nosort
SELECT d
  FROM t1
 WHERE (e>a AND e<b)
    OR (e>c OR e<d)
 ORDER BY 1
----
101
108
114
116
122
128
133
136
140
148
154
156
164
169
171
178
183
185
190
196
203
207
212
217
222
226
233
238
248

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(a),
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       a+b*2
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (a>b-2 AND a<b+2)
 ORDER BY 5,6,3,1,2,4,7
----
0
21
205
207
111
205
617
0
20
201
203
222
201
601
0
13
168
169
333
168
502
0
16
182
183
333
182
544
0
11
159
156
555
159
475
0
19
199
196
555
199
595
0
25
229
226
555
229
685

query II nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d-e
  FROM t1
 WHERE b>c
   AND d>e
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1,2
----
222
2
333
2
333
3
333
4
444
1

query IIII nosort
SELECT abs(a),
       a+b*2+c*3+d*4,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE b>c
    OR (e>a AND e<b)
 ORDER BY 2,4,1,3
----
115
1172
708
0
121
1226
738
0
127
1272
760
0
138
1371
827
0
142
1411
851
0
153
1521
905
0
159
1564
940
0
168
1676
1000
0
191
1918
1158
0
199
1964
1180
0
216
2165
1297
0
220
2226
1338
0
229
2264
1360
0
234
2323
1391
0
239
2368
1416
0
245
2476
1484
0

query I nosort
SELECT a+b*2+c*3
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND c BETWEEN b-2 AND d+2
   AND b>c
 ORDER BY 1
----
905
1000
1391
1416

query IIIIIII nosort
SELECT d,
       abs(b-c),
       a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       e,
       b
  FROM t1
 ORDER BY 2,6,3,5,7,4,1
----
108
1
2
333
635
109
105
114
1
-1
222
674
110
112
116
1
-3
222
708
117
118
122
1
-3
222
738
120
124
154
1
2
333
905
152
151
164
1
3
444
966
162
160
169
1
1
333
1000
165
167
178
1
4
444
1057
177
175
185
1
2
333
1121
189
186
190
1
-3
222
1158
192
194
222
1
-3
222
1338
221
223
233
1
2
333
1391
230
232
238
1
3
444
1416
237
236
101
2
4
444
610
103
100
136
2
-1
222
827
135
139
140
2
-1
222
851
144
143
148
2
4
444
880
146
145
171
2
4
444
1030
173
170
203
2
1
333
1207
204
200
207
2
-1
222
1241
209
206
248
2
-4
111
1484
246
249
156
3
1
333
940
157
158
183
3
1
333
1096
180
181
196
3
1
333
1180
197
198
212
3
2
333
1277
210
211
217
3
-2
222
1297
219
218
226
3
1
333
1360
227
228
128
4
-2
222
760
126
129
133
4
1
333
793
132
130
241
4
3
444
1455
242
240

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       a+b*2+c*3
  FROM t1
 ORDER BY 1,2,3
----
111
1130
674
111
1371
827
111
1411
851
111
2069
1241
222
2019
1207
222
2125
1277
222
2419
1455
333
1067
635
333
1172
708
333
1226
738
333
1272
760
333
1521
905
333
1622
966
333
1676
1000
333
1828
1096
333
2165
1297
444
1325
793
444
1861
1121
444
1918
1158
444
2226
1338
444
2476
1484
555
1014
610
555
1472
880
555
1564
940
555
1714
1030
555
1769
1057
555
1964
1180
555
2264
1360
555
2323
1391
555
2368
1416

query IIIIIII nosort
SELECT c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a),
       d-e,
       b,
       abs(b-c),
       a+b*2+c*3
  FROM t1
 ORDER BY 6,1,4,2,5,3,7
----
-4
0
153
2
151
1
905
-3
0
239
1
236
1
1416
-3
0
163
2
160
1
966
-3
0
168
4
167
1
1000
-2
0
107
-1
105
1
635
-2
0
179
1
175
1
1057
-2
0
234
3
232
1
1391
-1
0
111
4
112
1
674
1
0
121
2
124
1
738
2
0
188
-4
186
1
1121
2
0
220
1
223
1
1338
3
0
191
-2
194
1
1158
3
0
115
-1
118
1
708
-1
0
201
-1
200
2
1207
-1
0
149
2
145
2
880
-1
0
245
2
249
2
1484
1
0
142
-4
143
2
851
1
0
104
-2
100
2
610
1
0
174
-2
170
2
1030
1
0
205
-2
206
2
1241
1
0
138
1
139
2
827
-2
0
216
-2
218
3
1297
-1
0
159
-1
158
3
940
-1
0
199
-1
198
3
1180
-1
0
229
-1
228
3
1360
1
0
182
3
181
3
1096
2
0
213
2
211
3
1277
-3
0
127
2
129
4
760
1
0
131
1
130
4
793
3
0
243
-1
240
4
1455

query IIII nosort
SELECT abs(b-c),
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       e
  FROM t1
 WHERE c>d
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,3,4,1
----
2
1529
610
103
1
1612
635
109
1
1680
674
110
1
1757
708
117
1
1826
738
120
4
1902
760
126
4
1985
793
132
2
2046
827
135
2
2131
851
144
2
2202
880
146
1
2281
905
152
3
2349
940
157
1
2432
966
162
1
2501
1000
165
2
2579
1030
173
1
2654
1057
177
3
2728
1096
180
1
2806
1121
189
1
2878
1158
192
3
2949
1180
197
2
3039
1207
204
2
3114
1241
209
3
3175
1277
210
3
3260
1297
219
1
3331
1338
221
3
3399
1360
227
1
3473
1391
230
1
3553
1416
237
4
3629
1455
242
2
3706
1484
246

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a,
       a+b*2+c*3,
       abs(b-c),
       c-d,
       a+b*2+c*3+d*4
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 3,2,6,4,5,1
----
3
115
708
1
3
1172
18
191
1158
1
3
1918
24
220
1338
1
2
2226
29
245
1484
2
-1
2476

query IIIIII nosort
SELECT d-e,
       a+b*2+c*3+d*4,
       d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b,
       b
  FROM t1
 WHERE c>d
   AND a>b
 ORDER BY 2,4,3,6,1,5
----
-2
1014
101
1000
4
100
1
1325
133
1300
1
130
-2
1714
171
1700
4
170
3
1828
183
364
1
181
-4
1861
185
376
2
186
2
2125
212
426
2
211
-1
2419
241
486
3
240

query I nosort
SELECT abs(b-c)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND c>d
 ORDER BY 1
----
1
1
2

query IIIIIII nosort
SELECT c,
       c-d,
       a+b*2+c*3+d*4,
       a+b*2+c*3+d*4+e*5,
       abs(b-c),
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND a>b
   AND c>d
 ORDER BY 7,1,5,3,2,4,6
----
102
1
1014
1529
2
102
0
172
1
1714
2579
2
172
0
184
1
1828
2728
3
182
0
187
2
1861
2806
1
187
0
214
2
2125
3175
3
212
0
244
3
2419
3629
4
242
0

query II nosort
SELECT a-b,
       a+b*2+c*3
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR d NOT BETWEEN 110 AND 150
    OR d>e
 ORDER BY 1,2
----
-4
1484
-3
738
-3
1158
-3
1338
-2
760
-2
1297
-1
674
-1
827
-1
851
-1
1241
1
793
1
940
1
1000
1
1096
1
1180
1
1207
1
1360
2
635
2
905
2
1121
2
1277
2
1391
3
966
3
1416
3
1455
4
610
4
880
4
1030
4
1057

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       c-d,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 2,3,4,5,1
----
555
1014
1
304
0
333
1067
-2
317
1
111
1130
-1
335
2
333
1172
3
351
3
333
1226
1
369
4
333
1272
-3
385
5
444
1325
1
391
6
111
1371
1
416
7
111
1411
1
428
8
555
1472
-1
439
9
333
1521
-4
455
10
555
1564
-1
475
11
333
1622
-3
483
12
333
1676
-3
502
13
555
1714
1
514
14
555
1769
-2
529
15
333
1828
1
544
16
444
1861
2
560
17
444
1918
3
579
18
555
1964
-1
595
19
222
2019
-1
601
20
111
2069
1
617
21
222
2125
2
635
22
333
2165
-2
652
23
444
2226
2
666
24
555
2264
-1
685
25
555
2323
-2
698
26
555
2368
-3
711
27
222
2419
3
723
28
444
2476
-1
743
29

query I nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE a>b
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
333
333
333
333
333
333
444
444
444
444

query I nosort
SELECT d-e
  FROM t1
 WHERE a>b
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
-4
-1
-1
1
1
2
2
2
3
4

query I nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR d NOT BETWEEN 110 AND 150
    OR b>c
 ORDER BY 1
----
111
111
111
111
222
222
222
333
333
333
333
333
333
333
333
444
444
444
444
444
555
555
555
555
555
555
555
555
555

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d>e
    OR (e>c OR e<d)
 ORDER BY 1,2
----
0
101
1
108
2
114
3
116
4
122
5
128
6
133
7
136
8
140
9
148
10
154
11
156
12
164
13
169
14
171
15
178
16
183
17
185
19
196
20
203
21
207
22
212
23
217
24
222
25
226
26
233
27
238
29
248

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,4,5,1,3
----
555
1529
444
610
0
333
1612
333
635
0
111
1680
222
674
0
333
1757
222
708
0
333
1826
222
738
0
333
1902
222
760
0

query IIII nosort
SELECT a,
       abs(a),
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 3,1,2,4
----
104
104
102
0
107
107
107
0
111
111
112
0
115
115
117
0
121
121
122
0
127
127
127
0
131
131
132
0
138
138
137
0
142
142
142
0
149
149
147
0
153
153
152
0
159
159
157
0
163
163
162
0
168
168
167
0
174
174
172
0
179
179
177
0
182
182
182
0
188
188
187
0
191
191
192
0
199
199
197
0
201
201
202
0
205
205
207
0
213
213
212
0
216
216
217
0
220
220
222
0
229
229
227
0
234
234
232
0
239
239
237
0
243
243
242
0
245
245
247
0

query IIIIIII nosort
SELECT b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2,
       b,
       abs(b-c),
       c-d
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d>e
   AND (a>b-2 AND a<b+2)
 ORDER BY 3,5,6,7,2,1,4
----
-1
1120
2
335
112
1
-1
-4
1300
6
391
130
4
1
2
1390
7
416
139
2
1
1
1670
13
502
167
1
-3
-3
364
16
544
181
3
1

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b,
       abs(b-c)
  FROM t1
 WHERE c>d
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 2,1,3
----
382
-3
1
440
-3
1
1180
-3
1
1240
-3
1
432
-2
3
1290
-2
4
410
-1
2
1390
-1
2
1430
-1
2
364
1
3
1300
1
4
1670
1
1
376
2
1
426
2
3
468
2
1
1050
2
1
1510
2
1
478
3
1
486
3
4
1600
3
1
358
4
1
1000
4
2
1700
4
2

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       a+b*2+c*3
  FROM t1
 WHERE b>c
    OR c BETWEEN b-2 AND d+2
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1,3,2
----
358
178
1057
364
183
1096
376
185
1121
382
190
1158
398
196
1180
402
203
1207
410
207
1241
426
212
1277
432
217
1297
440
222
1338
458
226
1360
468
233
1391
478
238
1416
486
241
1455
490
248
1484
1000
101
610
1050
108
635
1120
114
674
1240
122
738
1290
128
760
1300
133
793
1390
136
827
1430
140
851
1450
148
880
1510
154
905
1580
156
940
1600
164
966
1670
169
1000
1700
171
1030

query III nosort
SELECT (a+b+c+d+e)/5,
       a,
       b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 3,2,1
----
102
104
100
107
107
105
112
111
112
122
121
124
132
131
130
137
138
139
142
142
143
147
149
145
152
153
151
162
163
160
167
168
167
172
174
170
177
179
175
182
182
181
187
188
186
202
201
200
207
205
206
212
213
211
222
220
223
232
234
232
237
239
236
247
245
249

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a-b,
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a
  FROM t1
 ORDER BY 2,4,5,1,3
----
444
-4
245
0
245
333
-3
115
0
115
333
-3
121
0
121
444
-3
191
0
191
444
-3
220
0
220
333
-2
127
0
127
333
-2
216
0
216
111
-1
111
0
111
111
-1
138
0
138
111
-1
142
0
142
111
-1
205
0
205
444
1
131
0
131
555
1
159
0
159
333
1
168
0
168
333
1
182
0
182
555
1
199
0
199
222
1
201
0
201
555
1
229
0
229
333
2
107
0
107
333
2
153
0
153
444
2
188
0
188
222
2
213
0
213
555
2
234
0
234
333
3
163
0
163
555
3
239
0
239
222
3
243
0
243
555
4
104
0
104
555
4
149
0
149
555
4
174
0
174
555
4
179
0
179

query IIIII nosort
SELECT c,
       a-b,
       a+b*2+c*3,
       abs(b-c),
       a+b*2+c*3+d*4
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR d>e
    OR a>b
 ORDER BY 5,3,2,4,1
----
102
4
610
2
1014
106
2
635
1
1067
113
-1
674
1
1130
123
-3
738
1
1226
125
-2
760
4
1272
134
1
793
4
1325
137
-1
827
2
1371
147
4
880
2
1472
150
2
905
1
1521
155
1
940
3
1564
161
3
966
1
1622
166
1
1000
1
1676
172
4
1030
2
1714
176
4
1057
1
1769
184
1
1096
3
1828
187
2
1121
1
1861
193
-3
1158
1
1918
195
1
1180
3
1964
202
1
1207
2
2019
208
-1
1241
2
2069
214
2
1277
3
2125
215
-2
1297
3
2165
224
-3
1338
1
2226
225
1
1360
3
2264
231
2
1391
1
2323
235
3
1416
1
2368
244
3
1455
4
2419
247
-4
1484
2
2476

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(b-c),
       b-c,
       a+b*2+c*3
  FROM t1
 WHERE (e>c OR e<d)
   AND (c<=d-2 OR c>=d+2)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 2,5,4,6,3,1
----
212
222
0
3
-3
1277
107
333
0
1
-1
635
162
333
0
1
-1
966
152
333
0
1
1
905
167
333
0
1
1
1000
187
444
0
1
-1
1121
222
444
0
1
-1
1338
177
555
0
1
-1
1057
232
555
0
1
1
1391
237
555
0
1
1
1416

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(b-c),
       a,
       abs(a),
       b,
       a+b*2
  FROM t1
 WHERE a>b
    OR (a>b-2 AND a<b+2)
 ORDER BY 1,6,3,5,4,2
----
1529
2
104
104
100
304
1612
1
107
107
105
317
1680
1
111
111
112
335
1985
4
131
131
130
391
2046
2
138
138
139
416
2131
2
142
142
143
428
2202
2
149
149
145
439
2281
1
153
153
151
455
2349
3
159
159
158
475
2432
1
163
163
160
483
2501
1
168
168
167
502
2579
2
174
174
170
514
2654
1
179
179
175
529
2728
3
182
182
181
544
2806
1
188
188
186
560
2949
3
199
199
198
595
3039
2
201
201
200
601
3114
2
205
205
206
617
3175
3
213
213
211
635
3399
3
229
229
228
685
3473
1
234
234
232
698
3553
1
239
239
236
711
3629
4
243
243
240
723

query I nosort
SELECT abs(b-c)
  FROM t1
 ORDER BY 1
----
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4

query IIIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       b-c,
       d-e,
       a+b*2+c*3+d*4,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d
  FROM t1
 WHERE (e>a AND e<b)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 6,4,1,5,3,7,2
----
3331
-1
1
2226
440
24
222
3706
2
2
2476
490
29
248

query IIIIII nosort
SELECT a,
       a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 2,4,5,6,1,3
----
104
610
1529
1
0
101
107
635
1612
-2
0
108
111
674
1680
-1
0
114
115
708
1757
3
0
116
121
738
1826
1
0
122
127
760
1902
-3
0
128
153
905
2281
-4
0
154
159
940
2349
-1
0
156
163
966
2432
-3
0
164
168
1000
2501
-3
0
169
174
1030
2579
1
0
171
179
1057
2654
-2
0
178
182
1096
2728
1
0
183
188
1121
2806
2
0
185
191
1158
2878
3
0
190
199
1180
2949
-1
0
196
201
1207
3039
-1
0
203
205
1241
3114
1
0
207
213
1277
3175
2
0
212
216
1297
3260
-2
0
217
220
1338
3331
2
0
222
229
1360
3399
-1
0
226
234
1391
3473
-2
0
233
239
1416
3553
-3
0
238
243
1455
3629
3
0
241
245
1484
3706
-1
0
248

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (c<=d-2 OR c>=d+2)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
102
107
112
117
122
127
132
137
142
147
152
157
162
167
172
177
182
187
192
197
202
207
212
217
222
227
232
237
242
247

query I nosort
SELECT e
  FROM t1
 ORDER BY 1
----
103
109
110
117
120
126
132
135
144
146
152
157
162
165
173
177
180
189
192
197
204
209
210
219
221
227
230
237
242
246

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       a+b*2
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,2
----
1529
304
1612
317
1680
335
1757
351
1826
369
1902
385
1985
391
2046
416
2131
428
2202
439
2281
455
2432
483
2501
502
2579
514
2654
529
2728
544
2806
560
3039
601
3114
617
3175
635
3331
666
3473
698
3553
711
3706
743

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 2,3,1
----
490
111
2476
1120
222
1130
1180
222
1172
1240
222
1226
1290
222
1272
1390
222
1371
1430
222
1411
382
222
1918
410
222
2069
432
222
2165
440
222
2226
1050
333
1067
1300
333
1325
1510
333
1521
1580
333
1564
1670
333
1676
364
333
1828
376
333
1861
398
333
1964
402
333
2019
426
333
2125
458
333
2264
468
333
2323
1000
444
1014
1450
444
1472
1600
444
1622
1700
444
1714
358
444
1769
478
444
2368
486
444
2419

query I nosort
SELECT c
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1
----
102
106
150
155
161
166
172
176
184
187
193
195
202
208
214
215
224
225
231
235
244
247

query IIIII nosort
SELECT a+b*2,
       a,
       d,
       c,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 4,2,3,1,5
----
304
104
101
102
102
317
107
108
106
107
335
111
114
113
112
351
115
116
119
117
369
121
122
123
122
385
127
128
125
127
391
131
133
134
132
416
138
136
137
137
428
142
140
141
142
439
149
148
147
147
455
153
154
150
152
475
159
156
155
157
483
163
164
161
162
502
168
169
166
167
514
174
171
172
172
529
179
178
176
177
544
182
183
184
182
560
188
185
187
187
579
191
190
193
192
595
199
196
195
197
601
201
203
202
202
617
205
207
208
207
635
213
212
214
212
652
216
217
215
217
666
220
222
224
222
685
229
226
225
227
698
234
233
231
232
711
239
238
235
237
723
243
241
244
242
743
245
248
247
247

query IIIII nosort
SELECT a-b,
       a+b*2+c*3,
       a+b*2+c*3+d*4,
       d,
       (a+b+c+d+e)/5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 4,5,3,2,1
----
2
635
1067
108
107
-1
674
1130
114
112
-3
708
1172
116
117
-3
738
1226
122
122
-2
760
1272
128
127
1
793
1325
133
132
-1
827
1371
136
137
-1
851
1411
140
142
4
880
1472
148
147
2
905
1521
154
152
1
940
1564
156
157
3
966
1622
164
162
1
1000
1676
169
167
4
1030
1714
171
172
4
1057
1769
178
177
1
1096
1828
183
182
2
1121
1861
185
187
-3
1158
1918
190
192
1
1180
1964
196
197
1
1207
2019
203
202
-1
1241
2069
207
207
2
1277
2125
212
212
-2
1297
2165
217
217
-3
1338
2226
222
222
1
1360
2264
226
227
2
1391
2323
233
232
3
1416
2368
238
237
3
1455
2419
241
242
-4
1484
2476
248
247

query I nosort
SELECT d-e
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 1
----
-4
-4
-2
-2
-2
-1
-1
1
1
1
1
1
2
2
2
2
2
2
3
3
4
4

query III nosort
SELECT abs(b-c),
       a+b*2+c*3,
       a+b*2
  FROM t1
 ORDER BY 1,3,2
----
1
635
317
1
674
335
1
708
351
1
738
369
1
905
455
1
966
483
1
1000
502
1
1057
529
1
1121
560
1
1158
579
1
1338
666
1
1391
698
1
1416
711
2
610
304
2
827
416
2
851
428
2
880
439
2
1030
514
2
1207
601
2
1241
617
2
1484
743
3
940
475
3
1096
544
3
1180
595
3
1277
635
3
1297
652
3
1360
685
4
760
385
4
793
391
4
1455
723

query IIIII nosort
SELECT d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       d-e,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE d>e
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 4,3,5,1,2
----
133
444
131
1
1985
136
111
138
1
2046
178
555
179
1
2654
222
444
220
1
3331
238
555
239
1
3553
122
333
121
2
1826
128
333
127
2
1902
148
555
149
2
2202
154
333
153
2
2281
164
333
163
2
2432
212
222
213
2
3175
248
444
245
2
3706
183
333
182
3
2728
233
555
234
3
3473
114
111
111
4
1680
169
333
168
4
2501

query IIIIII nosort
SELECT abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e,
       a+b*2,
       a,
       a-b
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,2,5,3,6,4
----
107
333
109
317
107
2
115
222
117
351
115
-3
127
222
126
385
127
-2
153
333
152
455
153
2
163
444
162
483
163
3
168
333
165
502
168
1
179
444
177
529
179
4
188
333
189
560
188
2
191
222
192
579
191
-3
213
333
210
635
213
2
216
222
219
652
216
-2
220
222
221
666
220
-3
234
333
230
698
234
2
239
444
237
711
239
3
243
444
242
723
243
3

query IIIIII nosort
SELECT a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       b-c,
       a+b*2+c*3+d*4,
       b,
       abs(b-c)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d NOT BETWEEN 110 AND 150
   AND (e>a AND e<b)
 ORDER BY 4,1,5,6,2,3
----
-3
222
-1
2226
223
1
-4
111
2
2476
249
2

query IIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(b-c),
       b-c,
       c,
       a+b*2+c*3+d*4,
       (a+b+c+d+e)/5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND b>c
   AND (a>b-2 AND a<b+2)
 ORDER BY 3,5,2,1,6,4
----

query IIII nosort
SELECT b,
       a-b,
       a,
       abs(a)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,3,4
----
100
4
104
104
105
2
107
107
151
2
153
153
158
1
159
159
160
3
163
163
167
1
168
168
170
4
174
174
175
4
179
179
181
1
182
182
186
2
188
188
194
-3
191
191
198
1
199
199
200
1
201
201
206
-1
205
205
211
2
213
213
218
-2
216
216
223
-3
220
220
228
1
229
229
232
2
234
234
236
3
239
239
240
3
243
243
249
-4
245
245

query IIIIIII nosort
SELECT a+b*2+c*3,
       c,
       b-c,
       a+b*2+c*3+d*4,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (a+b+c+d+e)/5
  FROM t1
 WHERE (e>c OR e<d)
   AND c BETWEEN b-2 AND d+2
   AND (e>a AND e<b)
 ORDER BY 7,5,3,2,6,4,1
----
1338
224
-1
2226
220
0
222
1484
247
2
2476
245
0
247

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       b-c,
       d-e
  FROM t1
 ORDER BY 2,3,1
----
3629
-4
-1
1985
-4
1
3175
-3
2
2728
-3
3
1529
-2
-2
2579
-2
-2
3114
-2
-2
3039
-2
-1
2202
-2
2
2806
-1
-4
1612
-1
-1
1757
-1
-1
2654
-1
1
3331
-1
1
2432
-1
2
1680
-1
4
2878
1
-2
3553
1
1
1826
1
2
2281
1
2
3473
1
3
2501
1
4
2131
2
-4
2046
2
1
3706
2
2
3260
3
-2
2349
3
-1
2949
3
-1
3399
3
-1
1902
4
2

query III nosort
SELECT a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (a>b-2 AND a<b+2)
   AND c>d
 ORDER BY 1,2,3
----

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e,
       abs(a),
       c-d,
       a,
       b-c
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR (c<=d-2 OR c>=d+2)
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 7,1,5,3,4,6,2
----
0
1300
132
131
1
131
-4
0
486
242
243
3
243
-4
0
364
180
182
1
182
-3
0
426
210
213
2
213
-3
0
402
204
201
-1
201
-2
0
1000
103
104
1
104
-2
0
1700
173
174
1
174
-2
0
410
209
205
1
205
-2
0
1600
162
163
-3
163
-1
0
1050
109
107
-2
107
-1
0
358
177
179
-2
179
-1
0
1120
110
111
-1
111
-1
0
376
189
188
2
188
-1
0
440
221
220
2
220
-1
0
1180
117
115
3
115
-1
0
1510
152
153
-4
153
1
0
1670
165
168
-3
168
1
0
478
237
239
-3
239
1
0
468
230
234
-2
234
1
0
382
192
191
3
191
1
0
490
246
245
-1
245
2
0
1390
135
138
1
138
2
0
1430
144
142
1
142
2
0
432
219
216
-2
216
3
0
1580
157
159
-1
159
3
0
398
197
199
-1
199
3
0
458
227
229
-1
229
3
0
1290
126
127
-3
127
4

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2+c*3,
       a-b,
       abs(b-c),
       a+b*2
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 2,1,5,4,3
----
102
610
4
2
304
107
635
2
1
317
112
674
-1
1
335
122
738
-3
1
369
132
793
1
4
391
137
827
-1
2
416
142
851
-1
2
428
147
880
4
2
439
152
905
2
1
455
157
940
1
3
475
162
966
3
1
483
167
1000
1
1
502
172
1030
4
2
514
177
1057
4
1
529
182
1096
1
3
544
187
1121
2
1
560
197
1180
1
3
595
202
1207
1
2
601
207
1241
-1
2
617
212
1277
2
3
635
222
1338
-3
1
666
227
1360
1
3
685
232
1391
2
1
698
237
1416
3
1
711
247
1484
-4
2
743

query IIII nosort
SELECT b-c,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR (a>b-2 AND a<b+2)
    OR d>e
 ORDER BY 1,3,2,4
----
-4
134
6
132
-4
244
28
242
-3
184
16
182
-3
214
22
212
-2
147
9
147
-2
202
20
202
-2
208
21
207
-1
106
1
107
-1
113
2
112
-1
119
3
117
-1
161
12
162
-1
176
15
177
-1
187
17
187
-1
224
24
222
1
123
4
122
1
150
10
152
1
166
13
167
1
193
18
192
1
231
26
232
1
235
27
237
2
137
7
137
2
141
8
142
2
247
29
247
3
155
11
157
3
195
19
197
3
215
23
217
3
225
25
227
4
125
5
127

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 1
----
1529
1612
1680
1757
1826
1902
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2878
2949
3039
3114
3175
3260
3331
3399
3473
3553
3629
3706

query II nosort
SELECT (a+b+c+d+e)/5,
       c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 1,2
----
107
106
117
119
127
125
152
150
162
161
167
166
177
176
187
187
192
193
212
214
217
215
222
224
232
231
237
235
242
244

query IIIIII nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       abs(b-c),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,2,1,6,4,5
----
635
1612
1
333
317
1
674
1680
1
222
335
2
708
1757
1
222
351
3
738
1826
1
222
369
4
905
2281
1
333
455
10
966
2432
1
444
483
12
1000
2501
1
333
502
13
1057
2654
1
444
529
15
1121
2806
1
333
560
17
1158
2878
1
222
579
18
1338
3331
1
222
666
24
1391
3473
1
333
698
26
1416
3553
1
444
711
27
827
2046
2
222
416
7
851
2131
2
222
428
8
880
2202
2
444
439
9
1030
2579
2
444
514
14
1207
3039
2
333
601
20
1241
3114
2
222
617
21
1484
3706
2
111
743
29
940
2349
3
333
475
11
1096
2728
3
333
544
16
1180
2949
3
333
595
19
1277
3175
3
333
635
22
1297
3260
3
222
652
23
1360
3399
3
333
685
25
760
1902
4
222
385
5
793
1985
4
333
391
6
1455
3629
4
444
723
28

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       a,
       d-e
  FROM t1
 ORDER BY 1,2,3,4,5
----
358
15
4
179
1
364
16
1
182
3
376
17
2
188
-4
382
18
-3
191
-2
398
19
1
199
-1
402
20
1
201
-1
410
21
-1
205
-2
426
22
2
213
2
432
23
-2
216
-2
440
24
-3
220
1
458
25
1
229
-1
468
26
2
234
3
478
27
3
239
1
486
28
3
243
-1
490
29
-4
245
2
1000
0
4
104
-2
1050
1
2
107
-1
1120
2
-1
111
4
1180
3
-3
115
-1
1240
4
-3
121
2
1290
5
-2
127
2
1300
6
1
131
1
1390
7
-1
138
1
1430
8
-1
142
-4
1450
9
4
149
2
1510
10
2
153
2
1580
11
1
159
-1
1600
12
3
163
2
1670
13
1
168
4
1700
14
4
174
-2

query III nosort
SELECT a-b,
       b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 2,1,3
----
4
100
444
2
105
333
-1
112
222
-3
118
222
-3
124
222
-2
129
222
1
130
333
-1
139
222
-1
143
222
4
145
444
2
151
333
1
158
333
3
160
444
1
167
333
4
170
444
4
175
444
1
181
333
2
186
333
-3
194
222
1
198
333
1
200
333
-1
206
222
2
211
333
-2
218
222
-3
223
222
1
228
333
2
232
333
3
236
444
3
240
444
-4
249
111

query IIII nosort
SELECT e,
       a+b*2,
       abs(a),
       b
  FROM t1
 ORDER BY 4,2,1,3
----
103
304
104
100
109
317
107
105
110
335
111
112
117
351
115
118
120
369
121
124
126
385
127
129
132
391
131
130
135
416
138
139
144
428
142
143
146
439
149
145
152
455
153
151
157
475
159
158
162
483
163
160
165
502
168
167
173
514
174
170
177
529
179
175
180
544
182
181
189
560
188
186
192
579
191
194
197
595
199
198
204
601
201
200
209
617
205
206
210
635
213
211
219
652
216
218
221
666
220
223
227
685
229
228
230
698
234
232
237
711
239
236
242
723
243
240
246
743
245
249

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       b-c,
       d-e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 5,3,2,1,4
----
333
444
2806
-1
-4
222
444
2878
1
-2
222
333
3260
3
-2
333
333
1612
-1
-1
222
333
1757
-1
-1
444
222
3629
-4
-1
444
555
2654
-1
1
222
444
3331
-1
1
444
555
3553
1
1
222
333
1902
4
2
333
333
2281
1
2
444
333
2432
-1
2
333
222
3175
-3
2
333
555
3473
1
3
333
333
2501
1
4

query IIIIII nosort
SELECT abs(a),
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4,
       b-c
  FROM t1
 ORDER BY 6,1,3,5,4,2
----
131
1
6
1300
1325
-4
243
3
28
486
2419
-4
182
1
16
364
1828
-3
213
2
22
426
2125
-3
104
4
0
1000
1014
-2
149
4
9
1450
1472
-2
174
4
14
1700
1714
-2
201
1
20
402
2019
-2
205
-1
21
410
2069
-2
107
2
1
1050
1067
-1
111
-1
2
1120
1130
-1
115
-3
3
1180
1172
-1
163
3
12
1600
1622
-1
179
4
15
358
1769
-1
188
2
17
376
1861
-1
220
-3
24
440
2226
-1
121
-3
4
1240
1226
1
153
2
10
1510
1521
1
168
1
13
1670
1676
1
191
-3
18
382
1918
1
234
2
26
468
2323
1
239
3
27
478
2368
1
138
-1
7
1390
1371
2
142
-1
8
1430
1411
2
245
-4
29
490
2476
2
159
1
11
1580
1564
3
199
1
19
398
1964
3
216
-2
23
432
2165
3
229
1
25
458
2264
3
127
-2
5
1290
1272
4

query I nosort
SELECT d
  FROM t1
 ORDER BY 1
----
101
108
114
116
122
128
133
136
140
148
154
156
164
169
171
178
183
185
190
196
203
207
212
217
222
226
233
238
241
248

query III nosort
SELECT abs(b-c),
       a-b,
       (a+b+c+d+e)/5
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (a>b-2 AND a<b+2)
 ORDER BY 2,1,3
----
2
-4
247
1
-3
122
1
-3
222
1
-1
112
2
-1
137
2
-1
142
2
-1
207
1
1
167
2
1
202
3
1
157
3
1
182
3
1
197
3
1
227
4
1
132
1
2
107
1
2
152
1
2
187
1
2
232
3
2
212
1
3
162
1
3
237
1
4
177
2
4
102
2
4
147
2
4
172

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e,
       b-c
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND b>c
   AND c>d
 ORDER BY 2,1,3
----
222
120
1
222
135
2
222
144
2

query IIIII nosort
SELECT c-d,
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d,
       b-c
  FROM t1
 WHERE c>d
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND a>b
 ORDER BY 2,4,3,5,1
----
1
132
6
133
-4
1
172
14
171
-2
1
182
16
183
-3
2
187
17
185
-1
2
212
22
212
-3
3
242
28
241
-4

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE a>b
    OR (e>a AND e<b)
 ORDER BY 4,6,2,5,1,3
----
1769
178
0
358
176
15
1828
183
0
364
184
16
1861
185
0
376
187
17
1918
190
0
382
193
18
1964
196
0
398
195
19
2019
203
0
402
202
20
2125
212
0
426
214
22
2226
222
0
440
224
24
2264
226
0
458
225
25
2323
233
0
468
231
26
2368
238
0
478
235
27
2419
241
0
486
244
28
2476
248
0
490
247
29
1014
101
0
1000
102
0
1067
108
0
1050
106
1
1172
116
0
1180
119
3
1325
133
0
1300
134
6
1472
148
0
1450
147
9
1521
154
0
1510
150
10
1564
156
0
1580
155
11
1622
164
0
1600
161
12
1676
169
0
1670
166
13
1714
171
0
1700
172
14

query II nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 2,1
----
555
1529
333
1612
111
1680
333
1757
333
1826
333
1902
444
1985
111
2046
111
2131
555
2202
333
2281
555
2349
333
2432
333
2501
555
2579
555
2654
333
2728
444
2806
444
2878
555
2949
222
3039
111
3114
222
3175
333
3260
444
3331
555
3399
555
3473
555
3553
222
3629
444
3706

query II nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b
  FROM t1
 ORDER BY 1,2
----
111
112
111
139
111
143
111
206
222
200
222
211
222
240
333
105
333
118
333
124
333
129
333
151
333
160
333
167
333
181
333
218
444
130
444
186
444
194
444
223
444
249
555
100
555
145
555
158
555
170
555
175
555
198
555
228
555
232
555
236

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b,
       a,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3
  FROM t1
 WHERE a>b
   AND (e>c OR e<d)
 ORDER BY 3,7,2,5,6,4,1
----
0
100
104
1529
1000
555
610
0
105
107
1612
1050
333
635
0
130
131
1985
1300
444
793
0
145
149
2202
1450
555
880
0
151
153
2281
1510
333
905
0
158
159
2349
1580
555
940
0
160
163
2432
1600
333
966
0
167
168
2501
1670
333
1000
0
170
174
2579
1700
555
1030
0
175
179
2654
358
555
1057
0
181
182
2728
364
333
1096
0
186
188
2806
376
444
1121
0
198
199
2949
398
555
1180
0
200
201
3039
402
222
1207
0
211
213
3175
426
222
1277
0
228
229
3399
458
555
1360
0
232
234
3473
468
555
1391
0
236
239
3553
478
555
1416

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2+c*3+d*4+e*5,
       b-c,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       a-b
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND c>d
   AND b>c
 ORDER BY 6,5,7,4,3,1,2
----
192
2878
1
191
444
1918
-3

query IIIIIII nosort
SELECT b,
       c,
       abs(a),
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (a+b+c+d+e)/5
  FROM t1
 WHERE d>e
   AND c BETWEEN b-2 AND d+2
   AND (e>a AND e<b)
 ORDER BY 2,4,5,6,3,7,1
----
223
224
220
222
444
222
222
249
247
245
248
444
111
247

query II nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 2,1
----
115
3
191
18
220
24
245
29

query IIIII nosort
SELECT a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 4,5,3,2,1
----
1769
15
178
0
358
1828
16
183
0
364
1861
17
185
0
376
1918
18
190
0
382
1964
19
196
0
398
2019
20
203
0
402
2069
21
207
0
410
2125
22
212
0
426
2165
23
217
0
432
2226
24
222
0
440
2264
25
226
0
458
2323
26
233
0
468
2368
27
238
0
478
2419
28
241
0
486
2476
29
248
0
490
1014
0
101
0
1000
1067
1
108
0
1050
1130
2
114
0
1120
1172
3
116
0
1180
1226
4
122
0
1240
1272
5
128
0
1290
1325
6
133
0
1300
1371
7
136
0
1390
1411
8
140
0
1430
1472
9
148
0
1450
1521
10
154
0
1510
1564
11
156
0
1580
1622
12
164
0
1600
1676
13
169
0
1670
1714
14
171
0
1700

query I nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (e>a AND e<b)
   AND c BETWEEN b-2 AND d+2
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
222

query I nosort
SELECT d
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d>e
    OR a>b
 ORDER BY 1
----
101
108
114
116
122
128
133
136
148
154
156
164
169
171
178
183
185
196
203
212
222
226
233
238
241
248

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       b-c
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
1985
-4
2728
-3
3039
-2
3114
-2
1680
-1
2501
1
2046
2
2131
2
2349
3
2949
3
3399
3

query IIIIII nosort
SELECT a-b,
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(a),
       a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE b>c
   AND (c<=d-2 OR c>=d+2)
   AND c>d
 ORDER BY 2,1,5,6,4,3
----
-3
1918
18
191
1158
382

query II nosort
SELECT abs(a),
       a-b
  FROM t1
 ORDER BY 1,2
----
104
4
107
2
111
-1
115
-3
121
-3
127
-2
131
1
138
-1
142
-1
149
4
153
2
159
1
163
3
168
1
174
4
179
4
182
1
188
2
191
-3
199
1
201
1
205
-1
213
2
216
-2
220
-3
229
1
234
2
239
3
243
3
245
-4

query IIIIIII nosort
SELECT b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (a+b+c+d+e)/5,
       b,
       c-d,
       a+b*2,
       a+b*2+c*3
  FROM t1
 WHERE c>d
   AND (e>c OR e<d)
   AND d>e
 ORDER BY 4,7,5,2,1,6,3
----
1
333
122
124
1
369
738
-4
444
132
130
1
391
793
2
111
137
139
1
416
827
-3
333
182
181
1
544
1096
-3
222
212
211
2
635
1277
-1
444
222
223
2
666
1338

query IIIIIII nosort
SELECT c-d,
       a-b,
       b,
       b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c,
       a+b*2
  FROM t1
 ORDER BY 1,5,4,3,2,6,7
----
-4
2
151
1
1510
150
455
-3
3
236
1
478
235
711
-3
-2
129
4
1290
125
385
-3
3
160
-1
1600
161
483
-3
1
167
1
1670
166
502
-2
4
175
-1
358
176
529
-2
-2
218
3
432
215
652
-2
2
232
1
468
231
698
-2
2
105
-1
1050
106
317
-1
1
198
3
398
195
595
-1
1
200
-2
402
202
601
-1
1
228
3
458
225
685
-1
-4
249
2
490
247
743
-1
-1
112
-1
1120
113
335
-1
4
145
-2
1450
147
439
-1
1
158
3
1580
155
475
1
1
181
-3
364
184
544
1
-1
206
-2
410
208
617
1
4
100
-2
1000
102
304
1
-3
124
1
1240
123
369
1
1
130
-4
1300
134
391
1
-1
139
2
1390
137
416
1
-1
143
2
1430
141
428
1
4
170
-2
1700
172
514
2
2
186
-1
376
187
560
2
2
211
-3
426
214
635
2
-3
223
-1
440
224
666
3
-3
194
1
382
193
579
3
3
240
-4
486
244
723
3
-3
118
-1
1180
119
351

query IIII nosort
SELECT a+b*2+c*3,
       a,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR b>c
 ORDER BY 2,4,3,1
----
674
111
222
111
738
121
222
121
760
127
222
127
793
131
333
131
827
138
222
138
851
142
222
142
905
153
333
153
940
159
333
159
1000
168
333
168
1096
182
333
182
1158
191
222
191
1180
199
333
199
1207
201
333
201
1241
205
222
205
1297
216
222
216
1360
229
333
229
1391
234
333
234
1416
239
444
239
1484
245
111
245

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       abs(a),
       e,
       a+b*2
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 3,4,2,1,5
----
1000
101
104
103
304
1050
108
107
109
317
1120
114
111
110
335
1240
122
121
120
369
1300
133
131
132
391
1390
136
138
135
416
1430
140
142
144
428
1450
148
149
146
439
1510
154
153
152
455
1600
164
163
162
483
1670
169
168
165
502
1700
171
174
173
514
358
178
179
177
529
364
183
182
180
544
376
185
188
189
560
402
203
201
204
601
410
207
205
209
617
426
212
213
210
635
440
222
220
221
666
468
233
234
230
698
478
238
239
237
711
490
248
245
246
743

query IIII nosort
SELECT b,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND e+d BETWEEN a+b-10 AND c+130
   AND (e>c OR e<d)
 ORDER BY 2,1,4,3
----
105
1
333
-1
129
4
333
4

query IIII nosort
SELECT b-c,
       e,
       c-d,
       a-b
  FROM t1
 WHERE b>c
    OR c BETWEEN b-2 AND d+2
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 4,1,2,3
----
2
246
-1
-4
-1
221
2
-3
1
120
1
-3
1
192
3
-3
3
219
-2
-2
4
126
-3
-2
-2
209
1
-1
-1
110
-1
-1
2
135
1
-1
2
144
1
-1
-4
132
1
1
-3
180
1
1
-2
204
-1
1
1
165
-3
1
3
157
-1
1
3
197
-1
1
3
227
-1
1
-3
210
2
2
-1
109
-2
2
-1
189
2
2
1
152
-4
2
1
230
-2
2
-4
242
3
3
-1
162
-3
3
1
237
-3
3
-2
103
1
4
-2
146
-1
4
-2
173
1
4
-1
177
-2
4

query III nosort
SELECT a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       b
  FROM t1
 ORDER BY 1,2,3
----
1014
102
100
1067
107
105
1130
112
112
1172
117
118
1226
122
124
1272
127
129
1325
132
130
1371
137
139
1411
142
143
1472
147
145
1521
152
151
1564
157
158
1622
162
160
1676
167
167
1714
172
170
1769
177
175
1828
182
181
1861
187
186
1918
192
194
1964
197
198
2019
202
200
2069
207
206
2125
212
211
2165
217
218
2226
222
223
2264
227
228
2323
232
232
2368
237
236
2419
242
240
2476
247
249

query IIIII nosort
SELECT c-d,
       (a+b+c+d+e)/5,
       abs(b-c),
       c,
       d
  FROM t1
 WHERE c>d
    OR a>b
 ORDER BY 4,2,3,1,5
----
1
102
2
102
101
-2
107
1
106
108
3
117
1
119
116
1
122
1
123
122
1
132
4
134
133
1
137
2
137
136
1
142
2
141
140
-1
147
2
147
148
-4
152
1
150
154
-1
157
3
155
156
-3
162
1
161
164
-3
167
1
166
169
1
172
2
172
171
-2
177
1
176
178
1
182
3
184
183
2
187
1
187
185
3
192
1
193
190
-1
197
3
195
196
-1
202
2
202
203
1
207
2
208
207
2
212
3
214
212
2
222
1
224
222
-1
227
3
225
226
-2
232
1
231
233
-3
237
1
235
238
3
242
4
244
241

query III nosort
SELECT a+b*2+c*3,
       d,
       abs(b-c)
  FROM t1
 ORDER BY 3,1,2
----
635
108
1
674
114
1
708
116
1
738
122
1
905
154
1
966
164
1
1000
169
1
1057
178
1
1121
185
1
1158
190
1
1338
222
1
1391
233
1
1416
238
1
610
101
2
827
136
2
851
140
2
880
148
2
1030
171
2
1207
203
2
1241
207
2
1484
248
2
940
156
3
1096
183
3
1180
196
3
1277
212
3
1297
217
3
1360
226
3
760
128
4
793
133
4
1455
241
4

query IIII nosort
SELECT e,
       a+b*2+c*3,
       abs(b-c),
       d-e
  FROM t1
 ORDER BY 1,3,4,2
----
103
610
2
-2
109
635
1
-1
110
674
1
4
117
708
1
-1
120
738
1
2
126
760
4
2
132
793
4
1
135
827
2
1
144
851
2
-4
146
880
2
2
152
905
1
2
157
940
3
-1
162
966
1
2
165
1000
1
4
173
1030
2
-2
177
1057
1
1
180
1096
3
3
189
1121
1
-4
192
1158
1
-2
197
1180
3
-1
204
1207
2
-1
209
1241
2
-2
210
1277
3
2
219
1297
3
-2
221
1338
1
1
227
1360
3
-1
230
1391
1
3
237
1416
1
1
242
1455
4
-1
246
1484
2
2

query IIII nosort
SELECT a,
       abs(a),
       d-e,
       e
  FROM t1
 ORDER BY 2,4,1,3
----
104
104
-2
103
107
107
-1
109
111
111
4
110
115
115
-1
117
121
121
2
120
127
127
2
126
131
131
1
132
138
138
1
135
142
142
-4
144
149
149
2
146
153
153
2
152
159
159
-1
157
163
163
2
162
168
168
4
165
174
174
-2
173
179
179
1
177
182
182
3
180
188
188
-4
189
191
191
-2
192
199
199
-1
197
201
201
-1
204
205
205
-2
209
213
213
2
210
216
216
-2
219
220
220
1
221
229
229
-1
227
234
234
3
230
239
239
1
237
243
243
-1
242
245
245
2
246

query II nosort
SELECT b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>a AND e<b)
    OR c>d
 ORDER BY 1,2
----
100
0
118
0
124
0
130
0
139
0
143
0
170
0
181
0
186
0
194
0
206
0
211
0
223
0
240
0
249
0

query III nosort
SELECT b-c,
       a-b,
       a+b*2
  FROM t1
 ORDER BY 1,2,3
----
-4
1
391
-4
3
723
-3
1
544
-3
2
635
-2
-1
617
-2
1
601
-2
4
304
-2
4
439
-2
4
514
-1
-3
351
-1
-3
666
-1
-1
335
-1
2
317
-1
2
560
-1
3
483
-1
4
529
1
-3
369
1
-3
579
1
1
502
1
2
455
1
2
698
1
3
711
2
-4
743
2
-1
416
2
-1
428
3
-2
652
3
1
475
3
1
595
3
1
685
4
-2
385

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(b-c)
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1
----
1612
1
1680
1
1757
1
1826
1
2281
1
2432
1
2501
1
2654
1
2806
1
2878
1
3331
1
3473
1
3553
1
2046
2
2131
2
2202
2
2579
2
3039
2
3114
2
3706
2
2349
3
2728
3
2949
3
3175
3
3260
3
3399
3
1902
4
1985
4
3629
4

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND c>d
 ORDER BY 1,3,2
----
0
104
1000
0
115
1180
0
121
1240

query I nosort
SELECT c-d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR d>e
 ORDER BY 1
----
-4
-3
-3
-3
-3
-2
-2
-2
-2
-1
-1
-1
-1
-1
-1
-1
1
1
1
1
1
1
1
2
2
2
3
3

query IIIIIII nosort
SELECT a-b,
       d,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (a+b+c+d+e)/5,
       b,
       d-e
  FROM t1
 ORDER BY 1,5,3,7,4,6,2
----
-4
248
1484
0
247
249
2
-3
116
708
0
117
118
-1
-3
122
738
0
122
124
2
-3
190
1158
0
192
194
-2
-3
222
1338
0
222
223
1
-2
128
760
0
127
129
2
-2
217
1297
0
217
218
-2
-1
114
674
0
112
112
4
-1
136
827
0
137
139
1
-1
140
851
0
142
143
-4
-1
207
1241
0
207
206
-2
1
133
793
0
132
130
1
1
156
940
0
157
158
-1
1
169
1000
0
167
167
4
1
183
1096
0
182
181
3
1
196
1180
0
197
198
-1
1
203
1207
0
202
200
-1
1
226
1360
0
227
228
-1
2
108
635
0
107
105
-1
2
154
905
0
152
151
2
2
185
1121
0
187
186
-4
2
212
1277
0
212
211
2
2
233
1391
0
232
232
3
3
164
966
0
162
160
2
3
238
1416
0
237
236
1
3
241
1455
0
242
240
-1
4
101
610
0
102
100
-2
4
148
880
0
147
145
2
4
171
1030
0
172
170
-2
4
178
1057
0
177
175
1

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       a,
       c-d,
       abs(b-c),
       b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>c OR e<d)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 4,3,2,5,1,6
----
1521
153
-4
1
151
1510
1622
163
-3
1
160
1600
1676
168
-3
1
167
1670
2368
239
-3
1
236
478
1067
107
-2
1
105
1050
1769
179
-2
1
175
358
2323
234
-2
1
232
468
1130
111
-1
1
112
1120
1226
121
1
1
124
1240
1861
188
2
1
186
376
2226
220
2
1
223
440
1172
115
3
1
118
1180
1918
191
3
1
194
382
1472
149
-1
2
145
1450
2019
201
-1
2
200
402
2476
245
-1
2
249
490
1014
104
1
2
100
1000
1371
138
1
2
139
1390
1411
142
1
2
143
1430
1714
174
1
2
170
1700
2069
205
1
2
206
410
2165
216
-2
3
218
432
1564
159
-1
3
158
1580
1964
199
-1
3
198
398
2264
229
-1
3
228
458
1828
182
1
3
181
364
2125
213
2
3
211
426
1272
127
-3
4
129
1290
1325
131
1
4
130
1300
2419
243
3
4
240
486

query IIIIII nosort
SELECT abs(b-c),
       (a+b+c+d+e)/5,
       d,
       b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c
  FROM t1
 ORDER BY 4,6,2,1,5,3
----
2
102
101
100
0
102
1
107
108
105
0
106
1
112
114
112
0
113
1
117
116
118
0
119
1
122
122
124
0
123
4
127
128
129
0
125
4
132
133
130
0
134
2
137
136
139
0
137
2
142
140
143
0
141
2
147
148
145
0
147
1
152
154
151
0
150
3
157
156
158
0
155
1
162
164
160
0
161
1
167
169
167
0
166
2
172
171
170
0
172
1
177
178
175
0
176
3
182
183
181
0
184
1
187
185
186
0
187
1
192
190
194
0
193
3
197
196
198
0
195
2
202
203
200
0
202
2
207
207
206
0
208
3
212
212
211
0
214
3
217
217
218
0
215
1
222
222
223
0
224
3
227
226
228
0
225
1
232
233
232
0
231
1
237
238
236
0
235
4
242
241
240
0
244
2
247
248
249
0
247

query IIIIII nosort
SELECT a,
       a+b*2+c*3+d*4+e*5,
       b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e,
       a-b
  FROM t1
 ORDER BY 1,4,5,3,6,2
----
104
1529
100
1000
103
4
107
1612
105
1050
109
2
111
1680
112
1120
110
-1
115
1757
118
1180
117
-3
121
1826
124
1240
120
-3
127
1902
129
1290
126
-2
131
1985
130
1300
132
1
138
2046
139
1390
135
-1
142
2131
143
1430
144
-1
149
2202
145
1450
146
4
153
2281
151
1510
152
2
159
2349
158
1580
157
1
163
2432
160
1600
162
3
168
2501
167
1670
165
1
174
2579
170
1700
173
4
179
2654
175
358
177
4
182
2728
181
364
180
1
188
2806
186
376
189
2
191
2878
194
382
192
-3
199
2949
198
398
197
1
201
3039
200
402
204
1
205
3114
206
410
209
-1
213
3175
211
426
210
2
216
3260
218
432
219
-2
220
3331
223
440
221
-3
229
3399
228
458
227
1
234
3473
232
468
230
2
239
3553
236
478
237
3
243
3629
240
486
242
3
245
3706
249
490
246
-4

query I nosort
SELECT abs(a)
  FROM t1
 WHERE a>b
 ORDER BY 1
----
104
107
131
149
153
159
163
168
174
179
182
188
199
201
213
229
234
239
243

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
1612
1757
1902
2281
2432
2501
2654
2806
2878
3175
3260
3331
3473
3553
3629

query IIIIIII nosort
SELECT e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b,
       b-c,
       (a+b+c+d+e)/5,
       a+b*2
  FROM t1
 WHERE (e>c OR e<d)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR b>c
 ORDER BY 4,6,3,1,5,7,2
----
246
29
111
-4
2
247
743
117
3
222
-3
-1
117
351
120
4
222
-3
1
122
369
192
18
222
-3
1
192
579
221
24
222
-3
-1
222
666
126
5
222
-2
4
127
385
219
23
222
-2
3
217
652
110
2
222
-1
-1
112
335
135
7
222
-1
2
137
416
144
8
222
-1
2
142
428
209
21
222
-1
-2
207
617
132
6
333
1
-4
132
391
157
11
333
1
3
157
475
165
13
333
1
1
167
502
180
16
333
1
-3
182
544
197
19
333
1
3
197
595
204
20
333
1
-2
202
601
227
25
333
1
3
227
685
109
1
333
2
-1
107
317
152
10
333
2
1
152
455
189
17
333
2
-1
187
560
210
22
333
2
-3
212
635
230
26
333
2
1
232
698
162
12
444
3
-1
162
483
237
27
444
3
1
237
711
242
28
444
3
-4
242
723
103
0
444
4
-2
102
304
146
9
444
4
-2
147
439
173
14
444
4
-2
172
514
177
15
444
4
-1
177
529

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4+e*5,
       b-c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 3,4,5,1,2
----
107
105
1
1612
-1
152
151
10
2281
1
162
160
12
2432
-1
167
167
13
2501
1
177
175
15
2654
-1
187
186
17
2806
-1
212
211
22
3175
-3
222
223
24
3331
-1
232
232
26
3473
1
237
236
27
3553
1

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
1612
1680
1757
1826
1902
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2878
2949
3039
3114
3175
3260
3331
3399
3473
3553
3629
3706

query IIIIII nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c),
       c,
       a-b,
       abs(a)
  FROM t1
 ORDER BY 6,1,3,5,2,4
----
104
0
2
102
4
104
107
1
1
106
2
107
111
2
1
113
-1
111
115
3
1
119
-3
115
121
4
1
123
-3
121
127
5
4
125
-2
127
131
6
4
134
1
131
138
7
2
137
-1
138
142
8
2
141
-1
142
149
9
2
147
4
149
153
10
1
150
2
153
159
11
3
155
1
159
163
12
1
161
3
163
168
13
1
166
1
168
174
14
2
172
4
174
179
15
1
176
4
179
182
16
3
184
1
182
188
17
1
187
2
188
191
18
1
193
-3
191
199
19
3
195
1
199
201
20
2
202
1
201
205
21
2
208
-1
205
213
22
3
214
2
213
216
23
3
215
-2
216
220
24
1
224
-3
220
229
25
3
225
1
229
234
26
1
231
2
234
239
27
1
235
3
239
243
28
4
244
3
243
245
29
2
247
-4
245

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c,
       a,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 2,3,1,4
----
0
102
104
102
0
106
107
107
0
113
111
112
0
119
115
117
0
123
121
122
0
125
127
127
0
134
131
132
0
137
138
137
0
141
142
142
0
147
149
147
0
150
153
152
0
155
159
157
0
161
163
162
0
166
168
167
0
172
174
172
0
176
179
177
0
184
182
182
0
187
188
187
0
193
191
192
0
195
199
197
0
202
201
202
0
208
205
207
0
214
213
212
0
215
216
217
0
224
220
222
0
225
229
227
0
231
234
232
0
235
239
237
0
244
243
242
0
247
245
247

query I nosort
SELECT abs(a)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d>e
   AND (e>a AND e<b)
 ORDER BY 1
----
220
245

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4+e*5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (a+b+c+d+e)/5,
       c-d
  FROM t1
 ORDER BY 2,4,5,1,3
----
444
1529
555
102
1
333
1612
333
107
-2
222
1680
111
112
-1
222
1757
333
117
3
222
1826
333
122
1
222
1902
333
127
-3
333
1985
444
132
1
222
2046
111
137
1
222
2131
111
142
1
444
2202
555
147
-1
333
2281
333
152
-4
333
2349
555
157
-1
444
2432
333
162
-3
333
2501
333
167
-3
444
2579
555
172
1
444
2654
555
177
-2
333
2728
333
182
1
333
2806
444
187
2
222
2878
444
192
3
333
2949
555
197
-1
333
3039
222
202
-1
222
3114
111
207
1
333
3175
222
212
2
222
3260
333
217
-2
222
3331
444
222
2
333
3399
555
227
-1
333
3473
555
232
-2
444
3553
555
237
-3
444
3629
222
242
3
111
3706
444
247
-1

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR (a>b-2 AND a<b+2)
 ORDER BY 4,3,2,1
----
333
109
1
1
111
110
2
1
333
117
3
1
333
152
10
1
333
162
12
1
333
165
13
1
555
177
15
1
444
189
17
1
444
192
18
1
444
221
24
1
555
230
26
1
555
237
27
1
111
135
7
2
111
144
8
2
222
204
20
2
111
209
21
2
555
157
11
3
333
180
16
3
555
197
19
3
222
210
22
3
333
219
23
3
555
227
25
3
333
126
5
4
444
132
6
4
222
242
28
4

query IIIIIII nosort
SELECT d,
       d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3
  FROM t1
 ORDER BY 3,2,4,5,7,1,6
----
178
1
358
529
2654
444
1057
183
3
364
544
2728
333
1096
185
-4
376
560
2806
333
1121
190
-2
382
579
2878
222
1158
196
-1
398
595
2949
333
1180
203
-1
402
601
3039
333
1207
207
-2
410
617
3114
222
1241
212
2
426
635
3175
333
1277
217
-2
432
652
3260
222
1297
222
1
440
666
3331
222
1338
226
-1
458
685
3399
333
1360
233
3
468
698
3473
333
1391
238
1
478
711
3553
444
1416
241
-1
486
723
3629
444
1455
248
2
490
743
3706
111
1484
101
-2
1000
304
1529
444
610
108
-1
1050
317
1612
333
635
114
4
1120
335
1680
222
674
116
-1
1180
351
1757
222
708
122
2
1240
369
1826
222
738
128
2
1290
385
1902
222
760
133
1
1300
391
1985
333
793
136
1
1390
416
2046
222
827
140
-4
1430
428
2131
222
851
148
2
1450
439
2202
444
880
154
2
1510
455
2281
333
905
156
-1
1580
475
2349
333
940
164
2
1600
483
2432
444
966
169
4
1670
502
2501
333
1000
171
-2
1700
514
2579
444
1030

query IIIII nosort
SELECT b,
       abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c,
       a-b
  FROM t1
 ORDER BY 4,5,3,2,1
----
130
131
444
-4
1
240
243
222
-4
3
181
182
333
-3
1
211
213
222
-3
2
206
205
111
-2
-1
200
201
222
-2
1
100
104
555
-2
4
145
149
555
-2
4
170
174
555
-2
4
118
115
333
-1
-3
223
220
444
-1
-3
112
111
111
-1
-1
105
107
333
-1
2
186
188
444
-1
2
160
163
333
-1
3
175
179
555
-1
4
124
121
333
1
-3
194
191
444
1
-3
167
168
333
1
1
151
153
333
1
2
232
234
555
1
2
236
239
555
1
3
249
245
444
2
-4
139
138
111
2
-1
143
142
111
2
-1
218
216
333
3
-2
158
159
555
3
1
198
199
555
3
1
228
229
555
3
1
129
127
333
4
-2

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d,
       (a+b+c+d+e)/5
  FROM t1
 WHERE (e>a AND e<b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 3,2,1,4
----
0
333
116
117
0
444
190
192
0
444
222
222

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c,
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR c>d
 ORDER BY 1,2,4,5,6,3
----
0
-3
222
125
128
5
0
-2
333
106
108
1
0
-1
222
113
114
2
0
1
444
102
101
0
0
1
222
123
122
4
0
1
333
134
133
6
0
1
222
137
136
7
0
1
222
141
140
8
0
1
444
172
171
14
0
1
333
184
183
16
0
1
222
208
207
21
0
2
333
187
185
17
0
2
333
214
212
22
0
2
222
224
222
24
0
3
222
119
116
3
0
3
222
193
190
18
0
3
444
244
241
28

query IIIII nosort
SELECT a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       d,
       e,
       a+b*2
  FROM t1
 ORDER BY 2,3,4,1,5
----
1014
102
101
103
304
1067
107
108
109
317
1130
112
114
110
335
1172
117
116
117
351
1226
122
122
120
369
1272
127
128
126
385
1325
132
133
132
391
1371
137
136
135
416
1411
142
140
144
428
1472
147
148
146
439
1521
152
154
152
455
1564
157
156
157
475
1622
162
164
162
483
1676
167
169
165
502
1714
172
171
173
514
1769
177
178
177
529
1828
182
183
180
544
1861
187
185
189
560
1918
192
190
192
579
1964
197
196
197
595
2019
202
203
204
601
2069
207
207
209
617
2125
212
212
210
635
2165
217
217
219
652
2226
222
222
221
666
2264
227
226
227
685
2323
232
233
230
698
2368
237
238
237
711
2419
242
241
242
723
2476
247
248
246
743

query III nosort
SELECT b,
       e,
       b-c
  FROM t1
 ORDER BY 2,1,3
----
100
103
-2
105
109
-1
112
110
-1
118
117
-1
124
120
1
129
126
4
130
132
-4
139
135
2
143
144
2
145
146
-2
151
152
1
158
157
3
160
162
-1
167
165
1
170
173
-2
175
177
-1
181
180
-3
186
189
-1
194
192
1
198
197
3
200
204
-2
206
209
-2
211
210
-3
218
219
3
223
221
-1
228
227
3
232
230
1
236
237
1
240
242
-4
249
246
2

query IIIIIII nosort
SELECT a+b*2+c*3,
       abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (e>a AND e<b)
 ORDER BY 1,5,3,4,6,2,7
----
1158
191
382
190
444
-2
0
1338
220
440
222
444
1
0
1484
245
490
248
444
2
0

query II nosort
SELECT b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (e>c OR e<d)
   AND c>d
 ORDER BY 2,1
----
-3
0
-1
0
-1
0

query IIIIII nosort
SELECT abs(b-c),
       a+b*2,
       d,
       b-c,
       a-b,
       d-e
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND c>d
 ORDER BY 3,1,2,5,6,4
----
4
391
133
-4
1
1
2
416
136
2
-1
1
2
428
140
2
-1
-4
3
544
183
-3
1
3
2
617
207
-2
-1
-2

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b
  FROM t1
 ORDER BY 1,2
----
0
100
0
105
0
112
0
118
0
124
0
129
0
130
0
139
0
143
0
145
0
151
0
158
0
160
0
167
0
170
0
175
0
181
0
186
0
194
0
198
0
200
0
206
0
211
0
218
0
223
0
228
0
232
0
236
0
240
0
249

query III nosort
SELECT d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,2,1
----
4
2
222
-1
3
222
2
4
222
2
5
222
-1
1
333
-2
0
444

query II nosort
SELECT abs(b-c),
       e
  FROM t1
 ORDER BY 2,1
----
2
103
1
109
1
110
1
117
1
120
4
126
4
132
2
135
2
144
2
146
1
152
3
157
1
162
1
165
2
173
1
177
3
180
1
189
1
192
3
197
2
204
2
209
3
210
3
219
1
221
3
227
1
230
1
237
4
242
2
246

query IIII nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4,
       a-b,
       a+b*2
  FROM t1
 WHERE d>e
   AND c>d
   AND a>b
 ORDER BY 3,1,2,4
----
793
1325
1
391
1096
1828
1
544
1277
2125
2
635

query III nosort
SELECT b,
       a+b*2+c*3,
       d-e
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 3,1,2
----
143
851
-4
206
1241
-2
158
940
-1
198
1180
-1
200
1207
-1
228
1360
-1
130
793
1
139
827
1
181
1096
3
112
674
4
167
1000
4

query IIIIII nosort
SELECT a-b,
       a,
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 4,5,1,6,3,2
----
-3
115
116
333
1
1757
-3
191
190
444
1
2878
-3
220
222
444
1
3331
-4
245
248
444
2
3706

query IIIII nosort
SELECT c-d,
       abs(a),
       a+b*2+c*3,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 4,2,5,1,3
----
-1
245
1484
111
490
-1
111
674
222
1120
3
115
708
222
1180
1
121
738
222
1240
-3
127
760
222
1290
1
138
827
222
1390
1
142
851
222
1430
3
191
1158
222
382
1
205
1241
222
410
-2
216
1297
222
432
2
220
1338
222
440
-2
107
635
333
1050
1
131
793
333
1300
-4
153
905
333
1510
-1
159
940
333
1580
-3
168
1000
333
1670
1
182
1096
333
364
2
188
1121
333
376
-1
199
1180
333
398
-1
201
1207
333
402
2
213
1277
333
426
-1
229
1360
333
458
-2
234
1391
333
468
1
104
610
444
1000
-1
149
880
444
1450
-3
163
966
444
1600
1
174
1030
444
1700
-2
179
1057
444
358
-3
239
1416
444
478
3
243
1455
444
486

query I nosort
SELECT a+b*2
  FROM t1
 WHERE a>b
    OR (e>c OR e<d)
 ORDER BY 1
----
304
317
335
369
385
391
416
428
439
455
475
483
502
514
529
544
560
595
601
617
635
652
666
685
698
711
723
743

query III nosort
SELECT c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1,3
----
-1
111
1130
1
111
1371
1
111
1411
1
111
2069
-1
222
2019
2
222
2125
3
222
2419
-4
333
1521
-3
333
1272
-3
333
1622
-3
333
1676
-2
333
1067
-2
333
2165
1
333
1226
1
333
1828
3
333
1172
-1
444
2476
1
444
1325
2
444
1861
2
444
2226
3
444
1918
-3
555
2368
-2
555
1769
-2
555
2323
-1
555
1472
-1
555
1564
-1
555
1964
-1
555
2264
1
555
1014
1
555
1714

query IIIII nosort
SELECT a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3,
       b,
       d
  FROM t1
 WHERE a>b
 ORDER BY 1,5,4,2,3
----
1014
0
610
100
101
1067
1
635
105
108
1325
6
793
130
133
1472
9
880
145
148
1521
10
905
151
154
1564
11
940
158
156
1622
12
966
160
164
1676
13
1000
167
169
1714
14
1030
170
171
1769
15
1057
175
178
1828
16
1096
181
183
1861
17
1121
186
185
1964
19
1180
198
196
2019
20
1207
200
203
2125
22
1277
211
212
2264
25
1360
228
226
2323
26
1391
232
233
2368
27
1416
236
238
2419
28
1455
240
241

query II nosort
SELECT b,
       a+b*2
  FROM t1
 WHERE (e>a AND e<b)
    OR (a>b-2 AND a<b+2)
    OR (e>c OR e<d)
 ORDER BY 2,1
----
100
304
105
317
112
335
118
351
124
369
129
385
130
391
139
416
143
428
145
439
151
455
158
475
160
483
167
502
170
514
175
529
181
544
186
560
194
579
198
595
200
601
206
617
211
635
218
652
223
666
228
685
232
698
236
711
249
743

query IIIII nosort
SELECT a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b,
       d-e,
       a+b*2+c*3
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND e+d BETWEEN a+b-10 AND c+130
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 3,2,5,4,1
----

query IIIIII nosort
SELECT e,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2,
       b,
       a+b*2+c*3
  FROM t1
 WHERE a>b
    OR (e>c OR e<d)
 ORDER BY 4,3,6,5,2,1
----
103
-2
0
304
100
610
109
-1
1
317
105
635
110
4
2
335
112
674
120
2
4
369
124
738
126
2
5
385
129
760
132
1
6
391
130
793
135
1
7
416
139
827
144
-4
8
428
143
851
146
2
9
439
145
880
152
2
10
455
151
905
157
-1
11
475
158
940
162
2
12
483
160
966
165
4
13
502
167
1000
173
-2
14
514
170
1030
177
1
15
529
175
1057
180
3
16
544
181
1096
189
-4
17
560
186
1121
197
-1
19
595
198
1180
204
-1
20
601
200
1207
209
-2
21
617
206
1241
210
2
22
635
211
1277
219
-2
23
652
218
1297
221
1
24
666
223
1338
227
-1
25
685
228
1360
230
3
26
698
232
1391
237
1
27
711
236
1416
242
-1
28
723
240
1455
246
2
29
743
249
1484

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       e,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 4,2,5,1,3
----
102
103
-2
0
1000
107
109
-1
1
1050
112
110
4
2
1120
117
117
-1
3
1180
122
120
2
4
1240
127
126
2
5
1290
132
132
1
6
1300
137
135
1
7
1390
142
144
-4
8
1430
147
146
2
9
1450
152
152
2
10
1510
157
157
-1
11
1580
162
162
2
12
1600
167
165
4
13
1670
172
173
-2
14
1700
177
177
1
15
358
182
180
3
16
364
187
189
-4
17
376
192
192
-2
18
382
197
197
-1
19
398
202
204
-1
20
402
207
209
-2
21
410
212
210
2
22
426
217
219
-2
23
432
222
221
1
24
440
227
227
-1
25
458
232
230
3
26
468
237
237
1
27
478
242
242
-1
28
486
247
246
2
29
490

query III nosort
SELECT b-c,
       a,
       d-e
  FROM t1
 ORDER BY 1,3,2
----
-4
243
-1
-4
131
1
-3
213
2
-3
182
3
-2
104
-2
-2
174
-2
-2
205
-2
-2
201
-1
-2
149
2
-1
188
-4
-1
107
-1
-1
115
-1
-1
179
1
-1
220
1
-1
163
2
-1
111
4
1
191
-2
1
239
1
1
121
2
1
153
2
1
234
3
1
168
4
2
142
-4
2
138
1
2
245
2
3
216
-2
3
159
-1
3
199
-1
3
229
-1
4
127
2

query III nosort
SELECT a,
       a+b*2+c*3+d*4+e*5,
       c-d
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 3,2,1
----
245
3706
-1
220
3331
2

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 1
----
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

query IIIIIII nosort
SELECT a-b,
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4+e*5,
       b,
       abs(b-c)
  FROM t1
 WHERE b>c
 ORDER BY 5,2,1,7,3,4,6
----
-3
1
222
122
1826
124
1
-2
-3
222
127
1902
129
4
-1
1
222
137
2046
139
2
-1
1
222
142
2131
143
2
2
-4
333
152
2281
151
1
1
-1
333
157
2349
158
3
1
-3
333
167
2501
167
1
-3
3
222
192
2878
194
1
1
-1
333
197
2949
198
3
-2
-2
222
217
3260
218
3
1
-1
333
227
3399
228
3
2
-2
333
232
3473
232
1
3
-3
444
237
3553
236
1
-4
-1
111
247
3706
249
2

query III nosort
SELECT d,
       (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE b>c
 ORDER BY 1,3,2
----
122
122
222
128
127
222
136
137
222
140
142
222
154
152
333
156
157
333
169
167
333
190
192
222
196
197
333
217
217
222
226
227
333
233
232
333
238
237
444
248
247
111

query IIII nosort
SELECT abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       b-c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 3,1,2,4
----
107
1050
105
-1
115
1180
118
-1
127
1290
129
4
153
1510
151
1
163
1600
160
-1
168
1670
167
1
179
358
175
-1
188
376
186
-1
191
382
194
1
213
426
211
-3
216
432
218
3
220
440
223
-1
234
468
232
1
239
478
236
1
243
486
240
-4

query IIIII nosort
SELECT a-b,
       c-d,
       a+b*2+c*3+d*4+e*5,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 1,4,3,2,5
----
-4
-1
3706
247
0
-3
3
1757
119
0
-3
1
1826
123
0
-3
3
2878
193
0
-3
2
3331
224
0
-2
-3
1902
125
0
-2
-2
3260
215
0
-1
-1
1680
113
0
-1
1
2046
137
0
-1
1
2131
141
0
-1
1
3114
208
0
1
1
1985
134
0
1
-1
2349
155
0
1
-3
2501
166
0
1
1
2728
184
0
1
-1
2949
195
0
1
-1
3039
202
0
1
-1
3399
225
0
2
-2
1612
106
0
2
-4
2281
150
0
2
2
2806
187
0
2
2
3175
214
0
2
-2
3473
231
0
3
-3
2432
161
0
3
-3
3553
235
0
3
3
3629
244
0
4
1
1529
102
0
4
-1
2202
147
0
4
1
2579
172
0
4
-2
2654
176
0

query IIIIII nosort
SELECT b-c,
       a-b,
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE b>c
    OR (a>b-2 AND a<b+2)
 ORDER BY 4,3,1,5,6,2
----
-1
-1
111
0
-1
111
1
-3
121
0
1
333
4
-2
127
0
-3
333
-4
1
131
0
1
444
2
-1
138
0
1
111
2
-1
142
0
1
111
1
2
153
0
-4
333
3
1
159
0
-1
555
1
1
168
0
-3
333
-3
1
182
0
1
333
1
-3
191
0
3
444
3
1
199
0
-1
555
-2
1
201
0
-1
222
-2
-1
205
0
1
111
3
-2
216
0
-2
333
3
1
229
0
-1
555
1
2
234
0
-2
555
1
3
239
0
-3
555
2
-4
245
0
-1
444

query IIIII nosort
SELECT a,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4,
       b
  FROM t1
 WHERE c>d
    OR d>e
 ORDER BY 2,5,1,3,4
----
179
358
0
1769
175
182
364
0
1828
181
188
376
0
1861
186
191
382
0
1918
194
205
410
0
2069
206
213
426
0
2125
211
220
440
0
2226
223
234
468
0
2323
232
239
478
0
2368
236
243
486
0
2419
240
245
490
0
2476
249
104
1000
0
1014
100
111
1120
0
1130
112
115
1180
0
1172
118
121
1240
0
1226
124
127
1290
0
1272
129
131
1300
0
1325
130
138
1390
0
1371
139
142
1430
0
1411
143
149
1450
0
1472
145
153
1510
0
1521
151
163
1600
0
1622
160
168
1670
0
1676
167
174
1700
0
1714
170

query IIIIII nosort
SELECT a+b*2,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b,
       a-b,
       b-c,
       d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR (c<=d-2 OR c>=d+2)
    OR (e>a AND e<b)
 ORDER BY 2,6,1,4,3,5
----
617
111
206
-1
-2
207
601
222
200
1
-2
203
635
222
211
2
-3
212
723
222
240
3
-4
241
317
333
105
2
-1
108
351
333
118
-3
-1
116
385
333
129
-2
4
128
455
333
151
2
1
154
483
333
160
3
-1
164
502
333
167
1
1
169
544
333
181
1
-3
183
652
333
218
-2
3
217
560
444
186
2
-1
185
579
444
194
-3
1
190
666
444
223
-3
-1
222
743
444
249
-4
2
248
304
555
100
4
-2
101
475
555
158
1
3
156
514
555
170
4
-2
171
529
555
175
4
-1
178
595
555
198
1
3
196
685
555
228
1
3
226
698
555
232
2
1
233
711
555
236
3
1
238

query IIIIIII nosort
SELECT d,
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5,
       e,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 6,5,1,7,2,3,4
----
101
-2
555
0
1529
103
102
108
-1
333
0
1612
109
107
114
4
111
0
1680
110
112
116
-1
333
0
1757
117
117
122
2
333
0
1826
120
122
128
2
333
0
1902
126
127
133
1
444
0
1985
132
132
136
1
111
0
2046
135
137
140
-4
111
0
2131
144
142
148
2
555
0
2202
146
147
154
2
333
0
2281
152
152
156
-1
555
0
2349
157
157
164
2
333
0
2432
162
162
169
4
333
0
2501
165
167
171
-2
555
0
2579
173
172
178
1
555
0
2654
177
177
183
3
333
0
2728
180
182
185
-4
444
0
2806
189
187
190
-2
444
0
2878
192
192
196
-1
555
0
2949
197
197
203
-1
222
0
3039
204
202
207
-2
111
0
3114
209
207
212
2
222
0
3175
210
212
217
-2
333
0
3260
219
217
222
1
444
0
3331
221
222
226
-1
555
0
3399
227
227
233
3
555
0
3473
230
232
238
1
555
0
3553
237
237
241
-1
222
0
3629
242
242
248
2
444
0
3706
246
247

query IIII nosort
SELECT c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4
  FROM t1
 WHERE b>c
    OR (e>c OR e<d)
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 3,2,1,4
----
176
0
358
1769
184
0
364
1828
187
0
376
1861
193
0
382
1918
195
0
398
1964
202
0
402
2019
208
0
410
2069
214
0
426
2125
215
0
432
2165
224
0
440
2226
225
0
458
2264
231
0
468
2323
235
0
478
2368
244
0
486
2419
247
0
490
2476
102
0
1000
1014
106
0
1050
1067
113
0
1120
1130
123
0
1240
1226
125
0
1290
1272
134
0
1300
1325
137
0
1390
1371
141
0
1430
1411
147
0
1450
1472
150
0
1510
1521
155
0
1580
1564
161
0
1600
1622
166
0
1670
1676
172
0
1700
1714

query III nosort
SELECT a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       abs(b-c)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 3,1,2
----
1067
107
1
1172
117
1
1521
152
1
1622
162
1
1676
167
1
1769
177
1
1861
187
1
1918
192
1
2226
222
1
2323
232
1
2368
237
1
2125
212
3
2165
217
3
1272
127
4
2419
242
4

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 1
----
1014
1067
1130
1226
1325
1371
1411
1472
1521
1622
1676
1714
1769
1828
1861
2019
2069
2125
2226
2323
2368
2476

query I nosort
SELECT a-b
  FROM t1
 WHERE c>d
 ORDER BY 1
----
-3
-3
-3
-3
-1
-1
-1
1
1
2
2
3
4
4

query IIIIIII nosort
SELECT a+b*2+c*3,
       d,
       e,
       a+b*2+c*3+d*4+e*5,
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c)
  FROM t1
 WHERE a>b
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 1,4,5,2,6,7,3
----
610
101
103
1529
104
0
2
635
108
109
1612
107
1
1
905
154
152
2281
153
10
1
940
156
157
2349
159
11
3
966
164
162
2432
163
12
1
1000
169
165
2501
168
13
1
1030
171
173
2579
174
14
2
1057
178
177
2654
179
15
1
1096
183
180
2728
182
16
3
1121
185
189
2806
188
17
1
1180
196
197
2949
199
19
3
1207
203
204
3039
201
20
2
1277
212
210
3175
213
22
3
1360
226
227
3399
229
25
3
1391
233
230
3473
234
26
1
1416
238
237
3553
239
27
1
1455
241
242
3629
243
28
4

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       abs(a),
       c,
       d-e
  FROM t1
 ORDER BY 5,4,1,2,3
----
111
142
142
141
-4
444
188
188
187
-4
555
104
104
102
-2
555
174
174
172
-2
444
191
191
193
-2
111
205
205
208
-2
333
216
216
215
-2
333
107
107
106
-1
333
115
115
119
-1
555
159
159
155
-1
555
199
199
195
-1
222
201
201
202
-1
555
229
229
225
-1
222
243
243
244
-1
444
131
131
134
1
111
138
138
137
1
555
179
179
176
1
444
220
220
224
1
555
239
239
235
1
333
121
121
123
2
333
127
127
125
2
555
149
149
147
2
333
153
153
150
2
333
163
163
161
2
222
213
213
214
2
444
245
245
247
2
333
182
182
184
3
555
234
234
231
3
111
111
111
113
4
333
168
168
166
4

query IIIIIII nosort
SELECT a+b*2+c*3+d*4,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a,
       d-e,
       e
  FROM t1
 ORDER BY 4,3,2,1,5,7,6
----
1014
555
610
0
104
-2
103
1067
333
635
0
107
-1
109
1130
111
674
0
111
4
110
1172
333
708
0
115
-1
117
1226
333
738
0
121
2
120
1272
333
760
0
127
2
126
1325
444
793
0
131
1
132
1371
111
827
0
138
1
135
1411
111
851
0
142
-4
144
1472
555
880
0
149
2
146
1521
333
905
0
153
2
152
1564
555
940
0
159
-1
157
1622
333
966
0
163
2
162
1676
333
1000
0
168
4
165
1714
555
1030
0
174
-2
173
1769
555
1057
0
179
1
177
1828
333
1096
0
182
3
180
1861
444
1121
0
188
-4
189
1918
444
1158
0
191
-2
192
1964
555
1180
0
199
-1
197
2019
222
1207
0
201
-1
204
2069
111
1241
0
205
-2
209
2125
222
1277
0
213
2
210
2165
333
1297
0
216
-2
219
2226
444
1338
0
220
1
221
2264
555
1360
0
229
-1
227
2323
555
1391
0
234
3
230
2368
555
1416
0
239
1
237
2419
222
1455
0
243
-1
242
2476
444
1484
0
245
2
246

query I nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1
----
364
398
402
410
458
1120
1300
1390
1430
1580
1670

query II nosort
SELECT d,
       c
  FROM t1
 ORDER BY 2,1
----
101
102
108
106
114
113
116
119
122
123
128
125
133
134
136
137
140
141
148
147
154
150
156
155
164
161
169
166
171
172
178
176
183
184
185
187
190
193
196
195
203
202
207
208
212
214
217
215
222
224
226
225
233
231
238
235
241
244
248
247

query I nosort
SELECT d-e
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND a>b
 ORDER BY 1
----
-4
-2
-1
-1
-1
-1
-1
-1
1
1
1
2
2
2
2
3
3
4

query IIIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       a+b*2,
       a+b*2+c*3,
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(b-c)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 4,3,2,5,7,1,6
----
555
1529
304
610
1014
0
2
333
1612
317
635
1067
0
1
333
2281
455
905
1521
0
1
555
2349
475
940
1564
0
3
333
2432
483
966
1622
0
1
333
2501
502
1000
1676
0
1
555
2579
514
1030
1714
0
2
555
2654
529
1057
1769
0
1
333
2728
544
1096
1828
0
3
444
2806
560
1121
1861
0
1
444
2878
579
1158
1918
0
1
555
2949
595
1180
1964
0
3
222
3039
601
1207
2019
0
2
111
3114
617
1241
2069
0
2
222
3175
635
1277
2125
0
3
333
3260
652
1297
2165
0
3
444
3331
666
1338
2226
0
1
555
3399
685
1360
2264
0
3
555
3473
698
1391
2323
0
1
555
3553
711
1416
2368
0
1
222
3629
723
1455
2419
0
4
444
3706
743
1484
2476
0
2

query IIIII nosort
SELECT d-e,
       b-c,
       a-b,
       a+b*2+c*3+d*4,
       abs(a)
  FROM t1
 ORDER BY 1,5,3,4,2
----
-4
2
-1
1411
142
-4
-1
2
1861
188
-2
-2
4
1014
104
-2
-2
4
1714
174
-2
1
-3
1918
191
-2
-2
-1
2069
205
-2
3
-2
2165
216
-1
-1
2
1067
107
-1
-1
-3
1172
115
-1
3
1
1564
159
-1
3
1
1964
199
-1
-2
1
2019
201
-1
3
1
2264
229
-1
-4
3
2419
243
1
-4
1
1325
131
1
2
-1
1371
138
1
-1
4
1769
179
1
-1
-3
2226
220
1
1
3
2368
239
2
1
-3
1226
121
2
4
-2
1272
127
2
-2
4
1472
149
2
1
2
1521
153
2
-1
3
1622
163
2
-3
2
2125
213
2
2
-4
2476
245
3
-3
1
1828
182
3
1
2
2323
234
4
-1
-1
1130
111
4
1
1
1676
168

query III nosort
SELECT d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1,3,2
----
-4
1430
0
-2
410
0
-1
398
0
-1
402
0
-1
458
0
-1
1580
0
1
1300
0
1
1390
0
3
364
0
4
1120
0
4
1670
0

query IIIIIII nosort
SELECT d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (a+b+c+d+e)/5,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c-d,
       d-e
  FROM t1
 WHERE b>c
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 2,3,6,7,4,1,5
----
101
0
102
4
0
1
-2
108
0
107
2
1
-2
-1
122
0
122
-3
4
1
2
128
0
127
-2
5
-3
2
136
0
137
-1
7
1
1
140
0
142
-1
8
1
-4
154
0
152
2
10
-4
2
156
0
157
1
11
-1
-1
164
0
162
3
12
-3
2
169
0
167
1
13
-3
4
171
0
172
4
14
1
-2
178
0
177
4
15
-2
1
183
0
182
1
16
1
3
185
0
187
2
17
2
-4
190
0
192
-3
18
3
-2
196
0
197
1
19
-1
-1
203
0
202
1
20
-1
-1
207
0
207
-1
21
1
-2
212
0
212
2
22
2
2
217
0
217
-2
23
-2
-2
222
0
222
-3
24
2
1
226
0
227
1
25
-1
-1
233
0
232
2
26
-2
3
238
0
237
3
27
-3
1
241
0
242
3
28
3
-1
248
0
247
-4
29
-1
2

query IIII nosort
SELECT b-c,
       a+b*2+c*3+d*4,
       c-d,
       a-b
  FROM t1
 ORDER BY 2,4,3,1
----
-2
1014
1
4
-1
1067
-2
2
-1
1130
-1
-1
-1
1172
3
-3
1
1226
1
-3
4
1272
-3
-2
-4
1325
1
1
2
1371
1
-1
2
1411
1
-1
-2
1472
-1
4
1
1521
-4
2
3
1564
-1
1
-1
1622
-3
3
1
1676
-3
1
-2
1714
1
4
-1
1769
-2
4
-3
1828
1
1
-1
1861
2
2
1
1918
3
-3
3
1964
-1
1
-2
2019
-1
1
-2
2069
1
-1
-3
2125
2
2
3
2165
-2
-2
-1
2226
2
-3
3
2264
-1
1
1
2323
-2
2
1
2368
-3
3
-4
2419
3
3
2
2476
-1
-4

query IIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 4,3,2,1
----
444
0
555
610
333
1
333
635
222
2
111
674
222
4
333
738
222
5
333
760
333
6
444
793
222
7
111
827
222
8
111
851
444
9
555
880
333
10
333
905
333
11
555
940
444
12
333
966
333
13
333
1000
444
14
555
1030
444
15
555
1057
333
16
333
1096
333
17
444
1121
333
19
555
1180
333
20
222
1207
222
21
111
1241
333
22
222
1277
222
23
333
1297
222
24
444
1338
333
25
555
1360
333
26
555
1391
444
27
555
1416
111
29
444
1484

query II nosort
SELECT (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR c BETWEEN b-2 AND d+2
    OR (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
102
0
107
0
112
0
117
0
122
0
127
0
132
0
137
0
142
0
147
0
152
0
157
0
162
0
167
0
172
0
177
0
182
0
187
0
192
0
197
0
202
0
207
0
212
0
217
0
222
0
227
0
232
0
237
0
242
0
247
0

query IIIIIII nosort
SELECT b,
       b-c,
       a+b*2+c*3,
       abs(a),
       c-d,
       a,
       d-e
  FROM t1
 WHERE b>c
 ORDER BY 4,6,1,3,7,2,5
----
124
1
738
121
1
121
2
129
4
760
127
-3
127
2
139
2
827
138
1
138
1
143
2
851
142
1
142
-4
151
1
905
153
-4
153
2
158
3
940
159
-1
159
-1
167
1
1000
168
-3
168
4
194
1
1158
191
3
191
-2
198
3
1180
199
-1
199
-1
218
3
1297
216
-2
216
-2
228
3
1360
229
-1
229
-1
232
1
1391
234
-2
234
3
236
1
1416
239
-3
239
1
249
2
1484
245
-1
245
2

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR c>d
 ORDER BY 1
----
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

query I nosort
SELECT c
  FROM t1
 ORDER BY 1
----
102
106
113
119
123
125
134
137
141
147
150
155
161
166
172
176
184
187
193
195
202
208
214
215
224
225
231
235
244
247

query IIII nosort
SELECT a+b*2,
       a+b*2+c*3,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 4,1,2,3
----
304
610
4
0
317
635
2
1
335
674
-1
2
351
708
-3
3
369
738
-3
4
385
760
-2
5
391
793
1
6
416
827
-1
7
428
851
-1
8
439
880
4
9
455
905
2
10
475
940
1
11
483
966
3
12
502
1000
1
13
514
1030
4
14
529
1057
4
15
544
1096
1
16
560
1121
2
17
579
1158
-3
18
595
1180
1
19
601
1207
1
20
617
1241
-1
21
635
1277
2
22
652
1297
-2
23
666
1338
-3
24
685
1360
1
25
698
1391
2
26
711
1416
3
27
723
1455
3
28
743
1484
-4
29

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b-c,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 6,4,5,1,2,3
----
112
111
0
-1
1680
2
132
131
0
-4
1985
6
137
138
0
2
2046
7
142
142
0
2
2131
8
157
159
0
3
2349
11
167
168
0
1
2501
13
182
182
0
-3
2728
16
197
199
0
3
2949
19
202
201
0
-2
3039
20
207
205
0
-2
3114
21
227
229
0
3
3399
25

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d-e,
       a,
       abs(a)
  FROM t1
 ORDER BY 3,1,4,2
----
0
-2
104
104
1
-1
107
107
2
4
111
111
3
-1
115
115
4
2
121
121
5
2
127
127
6
1
131
131
7
1
138
138
8
-4
142
142
9
2
149
149
10
2
153
153
11
-1
159
159
12
2
163
163
13
4
168
168
14
-2
174
174
15
1
179
179
16
3
182
182
17
-4
188
188
18
-2
191
191
19
-1
199
199
20
-1
201
201
21
-2
205
205
22
2
213
213
23
-2
216
216
24
1
220
220
25
-1
229
229
26
3
234
234
27
1
239
239
28
-1
243
243
29
2
245
245

query III nosort
SELECT a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 3,2,1
----
4
15
358
1
16
364
2
17
376
-3
18
382
1
19
398
1
20
402
-1
21
410
2
22
426
-2
23
432
-3
24
440
1
25
458
2
26
468
3
27
478
3
28
486
-4
29
490
4
0
1000
2
1
1050
-1
2
1120
-3
3
1180
-3
4
1240
-2
5
1290
1
6
1300
-1
7
1390
-1
8
1430
4
9
1450
2
10
1510
1
11
1580
3
12
1600
1
13
1670
4
14
1700

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND a>b
 ORDER BY 1
----
0
1

query IIIIII nosort
SELECT a+b*2+c*3,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 5,3,1,2,6,4
----
1455
244
486
240
-4
444
793
134
1300
130
-4
333
1096
184
364
181
-3
333
1277
214
426
211
-3
333
1207
202
402
200
-2
333
1241
208
410
206
-2
222
610
102
1000
100
-2
444
880
147
1450
145
-2
444
1030
172
1700
170
-2
444
1057
176
358
175
-1
444
1121
187
376
186
-1
333
1338
224
440
223
-1
222
635
106
1050
105
-1
333
674
113
1120
112
-1
222
708
119
1180
118
-1
222
966
161
1600
160
-1
444
1158
193
382
194
1
222
1391
231
468
232
1
333
1416
235
478
236
1
444
738
123
1240
124
1
222
905
150
1510
151
1
333
1000
166
1670
167
1
333
1484
247
490
249
2
111
827
137
1390
139
2
222
851
141
1430
143
2
222
1180
195
398
198
3
333
1297
215
432
218
3
222
1360
225
458
228
3
333
940
155
1580
158
3
333
760
125
1290
129
4
222

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1
----
1612
0
1680
0
1757
0
1826
0
1902
0
1985
0
2046
0
2131
0
2202
0
2281
0
2349
0
2432
0
2501
0
2579
0
2654
0
2728
0
2806
0
2878
0
2949
0
3039
0
3114
0
3175
0
3260
0
3331
0
3399
0
3473
0
3553
0
3629
0
3706
0

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a-b,
       abs(a)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d>e
    OR c BETWEEN b-2 AND d+2
 ORDER BY 4,1,5,6,3,2
----
0
2
555
0
4
104
1
1
333
0
2
107
2
1
111
0
-1
111
3
1
333
0
-3
115
4
1
333
0
-3
121
5
4
333
0
-2
127
6
4
444
0
1
131
7
2
111
0
-1
138
8
2
111
0
-1
142
9
2
555
0
4
149
10
1
333
0
2
153
12
1
333
0
3
163
13
1
333
0
1
168
14
2
555
0
4
174
15
1
555
0
4
179
16
3
333
0
1
182
17
1
444
0
2
188
20
2
222
0
1
201
21
2
111
0
-1
205
22
3
222
0
2
213
24
1
444
0
-3
220
26
1
555
0
2
234
27
1
555
0
3
239
29
2
444
0
-4
245

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>c OR e<d)
    OR (e>a AND e<b)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 2,1
----
1000
1529
1050
1612
1120
1680
1180
1757
1240
1826
1290
1902
1300
1985
1390
2046
1430
2131
1450
2202
1510
2281
1580
2349
1600
2432
1670
2501
1700
2579
358
2654
364
2728
376
2806
382
2878
398
2949
402
3039
410
3114
426
3175
432
3260
440
3331
458
3399
468
3473
478
3553
490
3706

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a
  FROM t1
 WHERE b>c
   AND c BETWEEN b-2 AND d+2
   AND (e>c OR e<d)
 ORDER BY 1,2
----
468
234
478
239
490
245
1240
121
1390
138
1430
142
1510
153
1670
168

query IIII nosort
SELECT a,
       b,
       abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR a>b
 ORDER BY 2,3,4,1
----
104
100
104
1000
107
105
107
1050
115
118
115
1180
127
129
127
1290
131
130
131
1300
149
145
149
1450
153
151
153
1510
159
158
159
1580
163
160
163
1600
168
167
168
1670
174
170
174
1700
179
175
179
358
182
181
182
364
188
186
188
376
191
194
191
382
199
198
199
398
201
200
201
402
213
211
213
426
216
218
216
432
220
223
220
440
229
228
229
458
234
232
234
468
239
236
239
478
243
240
243
486

query IIIIII nosort
SELECT a+b*2+c*3,
       d-e,
       a+b*2+c*3+d*4,
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(a)
  FROM t1
 WHERE b>c
   AND (e>c OR e<d)
 ORDER BY 2,3,4,5,6,1
----
851
-4
1411
140
111
142
1297
-2
2165
217
333
216
940
-1
1564
156
555
159
1180
-1
1964
196
555
199
1360
-1
2264
226
555
229
827
1
1371
136
111
138
1416
1
2368
238
555
239
738
2
1226
122
333
121
760
2
1272
128
333
127
905
2
1521
154
333
153
1484
2
2476
248
444
245
1391
3
2323
233
555
234
1000
4
1676
169
333
168

query III nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(b-c)
  FROM t1
 ORDER BY 3,2,1
----
107
0
1
111
0
1
115
0
1
121
0
1
153
0
1
163
0
1
168
0
1
179
0
1
188
0
1
191
0
1
220
0
1
234
0
1
239
0
1
104
0
2
138
0
2
142
0
2
149
0
2
174
0
2
201
0
2
205
0
2
245
0
2
159
0
3
182
0
3
199
0
3
213
0
3
216
0
3
229
0
3
127
0
4
131
0
4
243
0
4

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3,
       a-b
  FROM t1
 WHERE a>b
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 3,1,2
----
0
1000
1
0
635
2
0
905
2
0
1121
2
0
1277
2
0
1391
2
0
966
3
0
1416
3
0
1455
3
0
1057
4

query I nosort
SELECT b
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1
----
112
130
139
143
158
167
181
198
200
206
228

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d,
       a,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 2,5,3,1,4
----
0
101
104
610
0
1
108
107
635
0
2
114
111
674
0
4
122
121
738
0
6
133
131
793
0
7
136
138
827
0
8
140
142
851
0
9
148
149
880
0
10
154
153
905
0
12
164
163
966
0
13
169
168
1000
0
14
171
174
1030
0
15
178
179
1057
0
16
183
182
1096
0
17
185
188
1121
0
20
203
201
1207
0
21
207
205
1241
0
22
212
213
1277
0
24
222
220
1338
0
26
233
234
1391
0
27
238
239
1416
0
29
248
245
1484
0

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b,
       c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a
  FROM t1
 WHERE (e>a AND e<b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 5,3,2,1,4
----
333
118
119
222
115
444
194
193
222
191
444
223
224
222
220

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       a-b,
       a+b*2+c*3
  FROM t1
 ORDER BY 2,3,1
----
3706
-4
1484
1757
-3
708
1826
-3
738
2878
-3
1158
3331
-3
1338
1902
-2
760
3260
-2
1297
1680
-1
674
2046
-1
827
2131
-1
851
3114
-1
1241
1985
1
793
2349
1
940
2501
1
1000
2728
1
1096
2949
1
1180
3039
1
1207
3399
1
1360
1612
2
635
2281
2
905
2806
2
1121
3175
2
1277
3473
2
1391
2432
3
966
3553
3
1416
3629
3
1455
1529
4
610
2202
4
880
2579
4
1030
2654
4
1057

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c>d
 ORDER BY 2,3,1
----
333
364
0
444
376
0
444
382
0
111
410
0
222
426
0
444
440
0
222
486
0
555
1000
0
333
1180
0
333
1240
0
444
1300
0
111
1390
0
111
1430
0
555
1700
0

query II nosort
SELECT d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 1,2
----
101
1000
108
1050
114
1120
116
1180
122
1240
128
1290
133
1300
136
1390
140
1430
148
1450
154
1510
156
1580
164
1600
169
1670
171
1700
178
358
183
364
185
376
190
382
196
398
203
402
207
410
212
426
217
432
222
440
226
458
233
468
238
478
241
486
248
490

query IIII nosort
SELECT c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c,
       b
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 3,4,2,1
----
1
444
-4
130
3
222
-4
240
1
333
-3
181
2
222
-3
211
-1
222
-2
200
1
111
-2
206
-2
333
-1
105
-1
111
-1
112
3
333
-1
118
-3
333
-1
160
-2
555
-1
175
2
444
-1
186
2
444
-1
223
-4
333
1
151
-3
333
1
167
3
444
1
194
-2
555
1
232
-3
555
1
236
1
111
2
139
1
111
2
143
-1
555
3
158
-1
555
3
198
-2
333
3
218
-1
555
3
228
-3
333
4
129

query IIIIII nosort
SELECT abs(b-c),
       c,
       b,
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d
  FROM t1
 WHERE d>e
 ORDER BY 6,5,3,1,2,4
----
1
113
112
112
0
114
1
123
124
122
0
122
4
125
129
127
0
128
4
134
130
132
0
133
2
137
139
137
0
136
2
147
145
147
0
148
1
150
151
152
0
154
1
161
160
162
0
164
1
166
167
167
0
169
1
176
175
177
0
178
3
184
181
182
0
183
3
214
211
212
0
212
1
224
223
222
0
222
1
231
232
232
0
233
1
235
236
237
0
238
2
247
249
247
0
248

query I nosort
SELECT b-c
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
-4
-4
-3
-3
-2
-2
-2
-2
-1
-1
-1
-1
-1
-1
-1
1
1
1
1
1
1
2
2
2
3
3
3
3
4

query IIIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (a+b+c+d+e)/5,
       abs(a),
       abs(b-c),
       c-d
  FROM t1
 ORDER BY 3,7,1,4,6,2,5
----
1120
335
111
112
111
1
-1
410
617
111
207
205
2
1
1390
416
111
137
138
2
1
1430
428
111
142
142
2
1
402
601
222
202
201
2
-1
426
635
222
212
213
3
2
486
723
222
242
243
4
3
1510
455
333
152
153
1
-4
1290
385
333
127
127
4
-3
1600
483
333
162
163
1
-3
1670
502
333
167
168
1
-3
432
652
333
217
216
3
-2
1050
317
333
107
107
1
-2
364
544
333
182
182
3
1
1240
369
333
122
121
1
1
1180
351
333
117
115
1
3
490
743
444
247
245
2
-1
1300
391
444
132
131
4
1
376
560
444
187
188
1
2
440
666
444
222
220
1
2
382
579
444
192
191
1
3
478
711
555
237
239
1
-3
358
529
555
177
179
1
-2
468
698
555
232
234
1
-2
398
595
555
197
199
3
-1
458
685
555
227
229
3
-1
1450
439
555
147
149
2
-1
1580
475
555
157
159
3
-1
1000
304
555
102
104
2
1
1700
514
555
172
174
2
1

query III nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       e
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,1,2
----
104
0
103
107
1
109
111
2
110
121
4
120
127
5
126
131
6
132
138
7
135
142
8
144
149
9
146
153
10
152
159
11
157
163
12
162
168
13
165
174
14
173
179
15
177
182
16
180
188
17
189
199
19
197
201
20
204
205
21
209
213
22
210
216
23
219
220
24
221
229
25
227
234
26
230
239
27
237
245
29
246

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       a+b*2+c*3+d*4,
       (a+b+c+d+e)/5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 5,1,2,4,3,6,7
----
0
3
222
486
-4
2419
242
0
2
222
426
-3
2125
212
0
-3
333
1600
-1
1622
162
0
-2
555
358
-1
1769
177
0
-2
333
1050
-1
1067
107
0
2
444
376
-1
1861
187
0
2
444
440
-1
2226
222
0
3
333
1180
-1
1172
117
0
-4
333
1510
1
1521
152
0
-3
555
478
1
2368
237
0
-3
333
1670
1
1676
167
0
-2
555
468
1
2323
232
0
3
444
382
1
1918
192
0
-2
333
432
3
2165
217
0
-3
333
1290
4
1272
127

query I nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1
----
111
111
111
111
222
333
333
444
555
555
555

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (e>c OR e<d)
   AND e+d BETWEEN a+b-10 AND c+130
   AND c>d
 ORDER BY 2,1
----
1826
333
1529
555

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3,
       a,
       (a+b+c+d+e)/5,
       b
  FROM t1
 WHERE b>c
 ORDER BY 4,2,6,5,3,7,1
----
0
1826
4
738
121
122
124
0
1902
5
760
127
127
129
0
2046
7
827
138
137
139
0
2131
8
851
142
142
143
0
2281
10
905
153
152
151
0
2349
11
940
159
157
158
0
2501
13
1000
168
167
167
0
2878
18
1158
191
192
194
0
2949
19
1180
199
197
198
0
3260
23
1297
216
217
218
0
3399
25
1360
229
227
228
0
3473
26
1391
234
232
232
0
3553
27
1416
239
237
236
0
3706
29
1484
245
247
249

query IIII nosort
SELECT a+b*2,
       a-b,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 1,3,4,2
----
304
4
1529
0
317
2
1612
0
335
-1
1680
0
351
-3
1757
0
369
-3
1826
0
385
-2
1902
0
391
1
1985
0
416
-1
2046
0
428
-1
2131
0
439
4
2202
0
455
2
2281
0
475
1
2349
0
483
3
2432
0
502
1
2501
0
514
4
2579
0
529
4
2654
0
544
1
2728
0
560
2
2806
0
579
-3
2878
0
595
1
2949
0
601
1
3039
0
617
-1
3114
0
635
2
3175
0
652
-2
3260
0
666
-3
3331
0
685
1
3399
0
698
2
3473
0
711
3
3553
0
723
3
3629
0
743
-4
3706
0

query IIIII nosort
SELECT e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (a+b+c+d+e)/5,
       d,
       d-e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR d NOT BETWEEN 110 AND 150
    OR (e>c OR e<d)
 ORDER BY 5,4,2,3,1
----
144
1430
142
140
-4
189
376
187
185
-4
103
1000
102
101
-2
173
1700
172
171
-2
192
382
192
190
-2
209
410
207
207
-2
219
432
217
217
-2
109
1050
107
108
-1
117
1180
117
116
-1
157
1580
157
156
-1
197
398
197
196
-1
204
402
202
203
-1
227
458
227
226
-1
242
486
242
241
-1
132
1300
132
133
1
135
1390
137
136
1
177
358
177
178
1
221
440
222
222
1
237
478
237
238
1
120
1240
122
122
2
126
1290
127
128
2
146
1450
147
148
2
152
1510
152
154
2
162
1600
162
164
2
210
426
212
212
2
246
490
247
248
2
180
364
182
183
3
230
468
232
233
3
110
1120
112
114
4
165
1670
167
169
4

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c,
       d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 4,5,2,1,3
----
1680
0
1120
113
114
1985
0
1300
134
133
2046
0
1390
137
136
2131
0
1430
141
140
2349
0
1580
155
156
2501
0
1670
166
169
2728
0
364
184
183
2949
0
398
195
196
3039
0
402
202
203
3114
0
410
208
207
3399
0
458
225
226

query III nosort
SELECT c-d,
       abs(b-c),
       a+b*2
  FROM t1
 WHERE d>e
   AND a>b
 ORDER BY 1,2,3
----
-4
1
455
-3
1
483
-3
1
502
-3
1
711
-2
1
529
-2
1
698
-1
2
439
1
3
544
1
4
391
2
3
635

query II nosort
SELECT e,
       a+b*2+c*3
  FROM t1
 WHERE (e>a AND e<b)
    OR b>c
    OR (e>c OR e<d)
 ORDER BY 2,1
----
103
610
109
635
110
674
117
708
120
738
126
760
132
793
135
827
144
851
146
880
152
905
157
940
162
966
165
1000
173
1030
177
1057
180
1096
189
1121
192
1158
197
1180
204
1207
209
1241
210
1277
219
1297
221
1338
227
1360
230
1391
237
1416
246
1484

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 ORDER BY 1
----
102
107
112
117
122
127
132
137
142
147
152
157
162
167
172
177
182
187
192
197
202
207
212
217
222
227
232
237
242
247

query IIIII nosort
SELECT a+b*2+c*3+d*4,
       a+b*2+c*3+d*4+e*5,
       a,
       b,
       a+b*2
  FROM t1
 WHERE b>c
   AND (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 5,1,2,3,4
----
1918
2878
191
194
579
2476
3706
245
249
743

query III nosort
SELECT e,
       a+b*2+c*3+d*4,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 2,3,1
----
103
1014
102
109
1067
107
110
1130
112
117
1172
117
120
1226
122
126
1272
127
132
1325
132
135
1371
137
144
1411
142
146
1472
147
152
1521
152
157
1564
157
162
1622
162
165
1676
167
173
1714
172
177
1769
177
180
1828
182
189
1861
187
192
1918
192
197
1964
197
204
2019
202
209
2069
207
210
2125
212
219
2165
217
221
2226
222
227
2264
227
230
2323
232
237
2368
237
242
2419
242
246
2476
247

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4,
       a,
       abs(a),
       a-b
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 5,4,1,2,7,6,3
----
112
114
1120
1130
111
111
-1

query IIIIII nosort
SELECT c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 6,3,1,2,4,5
----
102
1000
-2
0
0
104
106
1050
-1
1
0
107
113
1120
-1
2
0
111
123
1240
1
4
0
121
134
1300
-4
6
0
131
137
1390
2
7
0
138
141
1430
2
8
0
142
147
1450
-2
9
0
149
150
1510
1
10
0
153
161
1600
-1
12
0
163
166
1670
1
13
0
168
172
1700
-2
14
0
174
176
358
-1
15
0
179
184
364
-3
16
0
182
187
376
-1
17
0
188
202
402
-2
20
0
201
208
410
-2
21
0
205
214
426
-3
22
0
213
224
440
-1
24
0
220
231
468
1
26
0
234
235
478
1
27
0
239
247
490
2
29
0
245

query IIII nosort
SELECT c-d,
       d-e,
       d,
       a+b*2+c*3
  FROM t1
 ORDER BY 3,2,4,1
----
1
-2
101
610
-2
-1
108
635
-1
4
114
674
3
-1
116
708
1
2
122
738
-3
2
128
760
1
1
133
793
1
1
136
827
1
-4
140
851
-1
2
148
880
-4
2
154
905
-1
-1
156
940
-3
2
164
966
-3
4
169
1000
1
-2
171
1030
-2
1
178
1057
1
3
183
1096
2
-4
185
1121
3
-2
190
1158
-1
-1
196
1180
-1
-1
203
1207
1
-2
207
1241
2
2
212
1277
-2
-2
217
1297
2
1
222
1338
-1
-1
226
1360
-2
3
233
1391
-3
1
238
1416
3
-1
241
1455
-1
2
248
1484

query I nosort
SELECT abs(b-c)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
1
1
1
1
1
1
1
1
1
3

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c
  FROM t1
 WHERE d>e
    OR a>b
 ORDER BY 4,3,2,1,5
----
0
-2
1000
0
102
0
-1
1050
1
106
0
4
1120
2
113
0
2
1240
4
123
0
2
1290
5
125
0
1
1300
6
134
0
1
1390
7
137
0
2
1450
9
147
0
2
1510
10
150
0
-1
1580
11
155
0
2
1600
12
161
0
4
1670
13
166
0
-2
1700
14
172
0
1
358
15
176
0
3
364
16
184
0
-4
376
17
187
0
-1
398
19
195
0
-1
402
20
202
0
2
426
22
214
0
1
440
24
224
0
-1
458
25
225
0
3
468
26
231
0
1
478
27
235
0
-1
486
28
244
0
2
490
29
247

query IIII nosort
SELECT (a+b+c+d+e)/5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(a),
       a+b*2
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 2,4,3,1
----
177
358
179
529
182
364
182
544
187
376
188
560
192
382
191
579
197
398
199
595
202
402
201
601
207
410
205
617
212
426
213
635
217
432
216
652
222
440
220
666
227
458
229
685
232
468
234
698
237
478
239
711
242
486
243
723
247
490
245
743
102
1000
104
304
107
1050
107
317
112
1120
111
335
117
1180
115
351
122
1240
121
369
127
1290
127
385
132
1300
131
391
137
1390
138
416
142
1430
142
428
147
1450
149
439
152
1510
153
455
157
1580
159
475
162
1600
163
483
167
1670
168
502
172
1700
174
514

query IIIIIII nosort
SELECT a,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       b-c,
       a+b*2+c*3+d*4,
       c-d,
       d-e
  FROM t1
 WHERE c>d
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 7,3,6,5,2,1,4
----
142
1430
222
2
1411
1
-4
188
376
333
-1
1861
2
-4
205
410
222
-2
2069
1
-2
191
382
222
1
1918
3
-2
104
1000
444
-2
1014
1
-2
174
1700
444
-2
1714
1
-2
115
1180
222
-1
1172
3
-1
107
1050
333
-1
1067
-2
-1
243
486
444
-4
2419
3
-1
138
1390
222
2
1371
1
1
220
440
222
-1
2226
2
1
131
1300
333
-4
1325
1
1
127
1290
222
4
1272
-3
2
121
1240
222
1
1226
1
2
213
426
333
-3
2125
2
2
182
364
333
-3
1828
1
3
111
1120
222
-1
1130
-1
4

query IIII nosort
SELECT abs(a),
       c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND (a>b-2 AND a<b+2)
 ORDER BY 1,3,2,4
----
111
113
111
4

query IIIIII nosort
SELECT a+b*2+c*3,
       c-d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 1,6,5,3,4,2
----
610
1
1000
1014
102
1529
635
-2
1050
1067
107
1612
674
-1
1120
1130
112
1680
708
3
1180
1172
117
1757
738
1
1240
1226
122
1826
760
-3
1290
1272
127
1902
793
1
1300
1325
132
1985
827
1
1390
1371
137
2046
851
1
1430
1411
142
2131
880
-1
1450
1472
147
2202
905
-4
1510
1521
152
2281
940
-1
1580
1564
157
2349
966
-3
1600
1622
162
2432
1000
-3
1670
1676
167
2501
1030
1
1700
1714
172
2579
1057
-2
358
1769
177
2654
1096
1
364
1828
182
2728
1121
2
376
1861
187
2806
1158
3
382
1918
192
2878
1180
-1
398
1964
197
2949
1207
-1
402
2019
202
3039
1241
1
410
2069
207
3114
1277
2
426
2125
212
3175
1297
-2
432
2165
217
3260
1338
2
440
2226
222
3331
1360
-1
458
2264
227
3399
1391
-2
468
2323
232
3473
1416
-3
478
2368
237
3553
1455
3
486
2419
242
3629
1484
-1
490
2476
247
3706

query I nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>c OR e<d)
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----
358
364
376
398
402
410
426
432
440
458
468
478
490
1000
1050
1120
1180
1240
1290
1300
1390
1430
1450
1510
1580
1600
1670
1700

query III nosort
SELECT b,
       a,
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 3,1,2
----
100
104
1014
105
107
1067
112
111
1130
118
115
1172
124
121
1226
129
127
1272
130
131
1325
139
138
1371
143
142
1411
145
149
1472
151
153
1521
158
159
1564
160
163
1622
167
168
1676
170
174
1714
175
179
1769
181
182
1828
186
188
1861
194
191
1918
198
199
1964
200
201
2019
206
205
2069
211
213
2125
218
216
2165
223
220
2226
228
229
2264
232
234
2323
236
239
2368
240
243
2419
249
245
2476

query III nosort
SELECT (a+b+c+d+e)/5,
       e,
       b
  FROM t1
 WHERE d>e
   AND (a>b-2 AND a<b+2)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 1,3,2
----
167
165
167
182
180
181

query IIII nosort
SELECT abs(a),
       a+b*2+c*3,
       (a+b+c+d+e)/5,
       b-c
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,3,2,4
----
104
610
102
-2
107
635
107
-1
111
674
112
-1
115
708
117
-1
121
738
122
1
127
760
127
4
131
793
132
-4
138
827
137
2
142
851
142
2
159
940
157
3
168
1000
167
1
182
1096
182
-3
199
1180
197
3
201
1207
202
-2
205
1241
207
-2
229
1360
227
3

query I nosort
SELECT a-b
  FROM t1
 ORDER BY 1
----
-4
-3
-3
-3
-3
-2
-2
-1
-1
-1
-1
1
1
1
1
1
1
1
2
2
2
2
2
3
3
3
4
4
4
4

query III nosort
SELECT a-b,
       d-e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 2,3,1
----
-1
-4
222
2
-4
333
-1
-2
222
4
-2
444
4
-2
444
1
-1
333
2
-1
333
-3
1
222
-1
1
222
1
1
333
3
1
444
4
1
444
-4
2
111
-3
2
222
2
2
333
2
2
333
3
2
444
4
2
444
1
3
333
2
3
333
-1
4
222
1
4
333

query I nosort
SELECT c
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1
----
102
106
113
123
125
134
137
141
147
150
155
161
166
172
176
184
187
195
202
208
214
215
224
225
231
235
247

query IIII nosort
SELECT a+b*2+c*3+d*4,
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 2,4,3,1
----
1130
1
2
222
1172
1
3
222
1226
1
4
222
1918
1
18
222
2226
1
24
222
1067
1
1
333
1521
1
10
333
1676
1
13
333
1861
1
17
333
2323
1
26
333
1622
1
12
444
1769
1
15
444
2368
1
27
444
2476
2
29
111
1371
2
7
222
1411
2
8
222
2069
2
21
222
2019
2
20
333
1014
2
0
444
1472
2
9
444
1714
2
14
444
2165
3
23
222
1564
3
11
333
1828
3
16
333
1964
3
19
333
2125
3
22
333
2264
3
25
333
1272
4
5
222
1325
4
6
333
2419
4
28
444

query I nosort
SELECT abs(a)
  FROM t1
 WHERE (e>c OR e<d)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
104
107
111
115
121
127
131
138
142
149
153
159
163
168
174
179
182
188
191
199
201
205
213
216
220
229
234
239
243
245

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2
  FROM t1
 ORDER BY 1,3,4,2
----
0
444
358
529
0
333
364
544
0
333
376
560
0
222
382
579
0
333
398
595
0
333
402
601
0
222
410
617
0
333
426
635
0
222
432
652
0
222
440
666
0
333
458
685
0
333
468
698
0
444
478
711
0
444
486
723
0
111
490
743
0
444
1000
304
0
333
1050
317
0
222
1120
335
0
222
1180
351
0
222
1240
369
0
222
1290
385
0
333
1300
391
0
222
1390
416
0
222
1430
428
0
444
1450
439
0
333
1510
455
0
333
1580
475
0
444
1600
483
0
333
1670
502
0
444
1700
514

query IIIIII nosort
SELECT c-d,
       a+b*2+c*3+d*4+e*5,
       b,
       (a+b+c+d+e)/5,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE d>e
 ORDER BY 4,5,6,1,3,2
----
-1
1680
112
112
111
0
1
1826
124
122
121
0
-3
1902
129
127
127
0
1
1985
130
132
131
0
1
2046
139
137
138
0
-1
2202
145
147
149
0
-4
2281
151
152
153
0
-3
2432
160
162
163
0
-3
2501
167
167
168
0
-2
2654
175
177
179
0
1
2728
181
182
182
0
2
3175
211
212
213
0
2
3331
223
222
220
0
-2
3473
232
232
234
0
-3
3553
236
237
239
0
-1
3706
249
247
245
0

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(b-c),
       c-d
  FROM t1
 ORDER BY 2,1,3,4,5
----
2131
-4
0
2
1
2806
-4
0
1
2
1529
-2
0
2
1
2579
-2
0
2
1
2878
-2
0
1
3
3114
-2
0
2
1
3260
-2
0
3
-2
1612
-1
0
1
-2
1757
-1
0
1
3
2349
-1
0
3
-1
2949
-1
0
3
-1
3039
-1
0
2
-1
3399
-1
0
3
-1
3629
-1
0
4
3
1985
1
0
4
1
2046
1
0
2
1
2654
1
0
1
-2
3331
1
0
1
2
3553
1
0
1
-3
1826
2
0
1
1
1902
2
0
4
-3
2202
2
0
2
-1
2281
2
0
1
-4
2432
2
0
1
-3
3175
2
0
3
2
3706
2
0
2
-1
2728
3
0
3
1
3473
3
0
1
-2
1680
4
0
1
-1
2501
4
0
1
-3

query IIIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d,
       e,
       abs(a),
       d
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (e>a AND e<b)
 ORDER BY 6,1,5,2,4,7,3
----
222
115
1180
3
117
115
116
222
191
382
3
192
191
190
222
220
440
2
221
220
222
111
245
490
-1
246
245
248

query III nosort
SELECT b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d
  FROM t1
 ORDER BY 3,2,1
----
100
444
101
105
333
108
112
222
114
118
222
116
124
222
122
129
222
128
130
333
133
139
222
136
143
222
140
145
444
148
151
333
154
158
333
156
160
444
164
167
333
169
170
444
171
175
444
178
181
333
183
186
333
185
194
222
190
198
333
196
200
333
203
206
222
207
211
333
212
218
222
217
223
222
222
228
333
226
232
333
233
236
444
238
240
444
241
249
111
248

query IIIII nosort
SELECT c-d,
       a-b,
       a+b*2+c*3+d*4,
       a+b*2+c*3+d*4+e*5,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 3,2,4,5,1
----
1
4
1014
1529
102
-2
2
1067
1612
107
-1
-1
1130
1680
112
3
-3
1172
1757
117
1
-3
1226
1826
122
-3
-2
1272
1902
127
1
1
1325
1985
132
1
-1
1371
2046
137
1
-1
1411
2131
142
-1
4
1472
2202
147
-4
2
1521
2281
152
-1
1
1564
2349
157
-3
3
1622
2432
162
-3
1
1676
2501
167
1
4
1714
2579
172
-2
4
1769
2654
177
1
1
1828
2728
182
2
2
1861
2806
187
3
-3
1918
2878
192
-1
1
1964
2949
197
-1
1
2019
3039
202
1
-1
2069
3114
207
2
2
2125
3175
212
-2
-2
2165
3260
217
2
-3
2226
3331
222
-1
1
2264
3399
227
-2
2
2323
3473
232
-3
3
2368
3553
237
3
3
2419
3629
242
-1
-4
2476
3706
247

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c-d
  FROM t1
 WHERE (e>c OR e<d)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (e>a AND e<b)
 ORDER BY 2,1,3
----
444
0
1
333
1
-2
222
2
-1
222
3
3
222
4
1
222
5
-3
333
6
1
222
7
1
222
8
1
444
9
-1
333
10
-4
333
11
-1
444
12
-3
333
13
-3
444
14
1
444
15
-2
333
16
1
333
17
2
222
18
3
333
19
-1
333
20
-1
222
21
1
333
22
2
222
23
-2
222
24
2
333
25
-1
333
26
-2
444
27
-3
444
28
3
111
29
-1

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e
  FROM t1
 ORDER BY 3,1,2
----
1529
0
103
1612
0
109
1680
0
110
1757
0
117
1826
0
120
1902
0
126
1985
0
132
2046
0
135
2131
0
144
2202
0
146
2281
0
152
2349
0
157
2432
0
162
2501
0
165
2579
0
173
2654
0
177
2728
0
180
2806
0
189
2878
0
192
2949
0
197
3039
0
204
3114
0
209
3175
0
210
3260
0
219
3331
0
221
3399
0
227
3473
0
230
3553
0
237
3629
0
242
3706
0
246

query IIIIII nosort
SELECT c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c,
       a+b*2+c*3,
       d-e,
       a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 3,4,6,5,1,2
----
1
555
102
610
-2
1529
-2
333
106
635
-1
1612
-1
111
113
674
4
1680
3
333
119
708
-1
1757
1
333
123
738
2
1826
-3
333
125
760
2
1902
1
444
134
793
1
1985
1
111
137
827
1
2046
1
111
141
851
-4
2131
-1
555
147
880
2
2202
-4
333
150
905
2
2281
-1
555
155
940
-1
2349
-3
333
161
966
2
2432
-3
333
166
1000
4
2501
1
555
172
1030
-2
2579
-2
555
176
1057
1
2654
1
333
184
1096
3
2728
2
444
187
1121
-4
2806
3
444
193
1158
-2
2878
-1
555
195
1180
-1
2949
-1
222
202
1207
-1
3039
1
111
208
1241
-2
3114
2
222
214
1277
2
3175
-2
333
215
1297
-2
3260
2
444
224
1338
1
3331
-1
555
225
1360
-1
3399
-2
555
231
1391
3
3473
-3
555
235
1416
1
3553
3
222
244
1455
-1
3629
-1
444
247
1484
2
3706

query IIIIIII nosort
SELECT a+b*2,
       a-b,
       c,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 5,3,2,7,4,6,1
----
335
-1
113
111
111
1680
674
416
-1
137
138
111
2046
827
428
-1
141
142
111
2131
851
617
-1
208
205
111
3114
1241
601
1
202
201
222
3039
1207
635
2
214
213
222
3175
1277
723
3
244
243
222
3629
1455
317
2
106
107
333
1612
635
351
-3
119
115
333
1757
708
369
-3
123
121
333
1826
738
385
-2
125
127
333
1902
760
455
2
150
153
333
2281
905
483
3
161
163
333
2432
966
502
1
166
168
333
2501
1000
544
1
184
182
333
2728
1096
652
-2
215
216
333
3260
1297
391
1
134
131
444
1985
793
560
2
187
188
444
2806
1121
579
-3
193
191
444
2878
1158
666
-3
224
220
444
3331
1338
743
-4
247
245
444
3706
1484
439
4
147
149
555
2202
880
475
1
155
159
555
2349
940
514
4
172
174
555
2579
1030
529
4
176
179
555
2654
1057
595
1
195
199
555
2949
1180
685
1
225
229
555
3399
1360
698
2
231
234
555
3473
1391
711
3
235
239
555
3553
1416

query I nosort
SELECT abs(b-c)
  FROM t1
 ORDER BY 1
----
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4

query IIIIII nosort
SELECT b,
       c,
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b-c,
       e
  FROM t1
 ORDER BY 4,5,1,6,2,3
----
130
134
131
0
-4
132
240
244
243
0
-4
242
181
184
182
0
-3
180
211
214
213
0
-3
210
100
102
104
0
-2
103
145
147
149
0
-2
146
170
172
174
0
-2
173
200
202
201
0
-2
204
206
208
205
0
-2
209
105
106
107
0
-1
109
112
113
111
0
-1
110
118
119
115
0
-1
117
160
161
163
0
-1
162
175
176
179
0
-1
177
186
187
188
0
-1
189
223
224
220
0
-1
221
124
123
121
0
1
120
151
150
153
0
1
152
167
166
168
0
1
165
194
193
191
0
1
192
232
231
234
0
1
230
236
235
239
0
1
237
139
137
138
0
2
135
143
141
142
0
2
144
249
247
245
0
2
246
158
155
159
0
3
157
198
195
199
0
3
197
218
215
216
0
3
219
228
225
229
0
3
227
129
125
127
0
4
126

query IIIII nosort
SELECT c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,4,3,5,2
----
102
0
-2
1000
100
106
1
-1
1050
105
113
2
4
1120
112
119
3
-1
1180
118
123
4
2
1240
124
125
5
2
1290
129

query II nosort
SELECT a,
       c
  FROM t1
 WHERE d>e
    OR b>c
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,2
----
104
102
107
106
111
113
115
119
121
123
127
125
131
134
138
137
142
141
149
147
153
150
159
155
163
161
168
166
179
176
182
184
191
193
199
195
213
214
216
215
220
224
229
225
234
231
239
235
245
247

query IIIIIII nosort
SELECT a+b*2+c*3+d*4,
       c-d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2,
       b,
       b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 5,2,4,1,6,3,7
----
1014
1
1000
304
100
-2
0
1067
-2
1050
317
105
-1
0
1130
-1
1120
335
112
-1
0
1172
3
1180
351
118
-1
0
1226
1
1240
369
124
1
0
1272
-3
1290
385
129
4
0
1325
1
1300
391
130
-4
0
1371
1
1390
416
139
2
0
1411
1
1430
428
143
2
0
1472
-1
1450
439
145
-2
0
1521
-4
1510
455
151
1
0
1564
-1
1580
475
158
3
0
1622
-3
1600
483
160
-1
0
1676
-3
1670
502
167
1
0
1714
1
1700
514
170
-2
0
1769
-2
358
529
175
-1
0
1828
1
364
544
181
-3
0
1861
2
376
560
186
-1
0
1918
3
382
579
194
1
0
1964
-1
398
595
198
3
0
2019
-1
402
601
200
-2
0
2069
1
410
617
206
-2
0
2125
2
426
635
211
-3
0
2165
-2
432
652
218
3
0
2226
2
440
666
223
-1
0
2264
-1
458
685
228
3
0
2323
-2
468
698
232
1
0
2368
-3
478
711
236
1
0
2419
3
486
723
240
-4
0
2476
-1
490
743
249
2
0

query IIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       b,
       abs(a),
       a+b*2,
       c-d
  FROM t1
 WHERE b>c
 ORDER BY 1,6,5,3,4,2
----
111
245
249
245
743
-1
222
127
129
127
385
-3
222
216
218
216
652
-2
222
121
124
121
369
1
222
138
139
138
416
1
222
142
143
142
428
1
222
191
194
191
579
3
333
153
151
153
455
-4
333
168
167
168
502
-3
333
234
232
234
698
-2
333
159
158
159
475
-1
333
199
198
199
595
-1
333
229
228
229
685
-1
444
239
236
239
711
-3

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 ORDER BY 1
----
1014
1067
1130
1172
1226
1272
1325
1371
1411
1472
1521
1564
1622
1676
1714
1769
1828
1861
1918
1964
2019
2069
2125
2165
2226
2264
2323
2368
2419
2476

query IIIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4,
       e,
       a+b*2,
       a+b*2+c*3,
       d,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 2,1,5,3,6,4,7
----
444
1014
103
304
610
101
102
333
1067
109
317
635
108
107
222
1130
110
335
674
114
112
222
1172
117
351
708
116
117
222
1226
120
369
738
122
122
222
1272
126
385
760
128
127
333
1325
132
391
793
133
132
222
1371
135
416
827
136
137
222
1411
144
428
851
140
142
444
1472
146
439
880
148
147
333
1521
152
455
905
154
152
333
1564
157
475
940
156
157
444
1622
162
483
966
164
162
333
1676
165
502
1000
169
167
444
1714
173
514
1030
171
172
444
1769
177
529
1057
178
177
333
1828
180
544
1096
183
182
333
1861
189
560
1121
185
187
222
1918
192
579
1158
190
192
333
1964
197
595
1180
196
197
333
2019
204
601
1207
203
202
222
2069
209
617
1241
207
207
333
2125
210
635
1277
212
212
222
2165
219
652
1297
217
217
222
2226
221
666
1338
222
222
333
2264
227
685
1360
226
227
333
2323
230
698
1391
233
232
444
2368
237
711
1416
238
237
444
2419
242
723
1455
241
242
111
2476
246
743
1484
248
247

query III nosort
SELECT d-e,
       c-d,
       a
  FROM t1
 WHERE b>c
   AND (e>a AND e<b)
   AND c>d
 ORDER BY 1,2,3
----
-2
3
191

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       a,
       abs(a)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR (c<=d-2 OR c>=d+2)
    OR d>e
 ORDER BY 3,5,6,2,1,7,4
----
0
617
111
21
-2
205
205
0
335
111
2
-1
111
111
0
416
111
7
2
138
138
0
428
111
8
2
142
142
0
723
222
28
-4
243
243
0
635
222
22
-3
213
213
0
601
222
20
-2
201
201
0
544
333
16
-3
182
182
0
317
333
1
-1
107
107
0
351
333
3
-1
115
115
0
483
333
12
-1
163
163
0
369
333
4
1
121
121
0
455
333
10
1
153
153
0
502
333
13
1
168
168
0
652
333
23
3
216
216
0
385
333
5
4
127
127
0
391
444
6
-4
131
131
0
560
444
17
-1
188
188
0
666
444
24
-1
220
220
0
579
444
18
1
191
191
0
743
444
29
2
245
245
0
439
555
9
-2
149
149
0
529
555
15
-1
179
179
0
698
555
26
1
234
234
0
711
555
27
1
239
239
0
475
555
11
3
159
159
0
595
555
19
3
199
199
0
685
555
25
3
229
229

query IIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e,
       (a+b+c+d+e)/5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR d NOT BETWEEN 110 AND 150
    OR d>e
 ORDER BY 1,4,2,3
----
111
246
247
490
222
192
192
382
222
209
207
410
222
219
217
432
222
221
222
440
222
110
112
1120
222
120
122
1240
222
126
127
1290
222
135
137
1390
222
144
142
1430
333
180
182
364
333
189
187
376
333
197
197
398
333
204
202
402
333
210
212
426
333
227
227
458
333
230
232
468
333
109
107
1050
333
132
132
1300
333
152
152
1510
333
157
157
1580
333
165
167
1670
444
177
177
358
444
237
237
478
444
242
242
486
444
103
102
1000
444
146
147
1450
444
162
162
1600
444
173
172
1700

query IIIIIII nosort
SELECT b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d,
       a+b*2+c*3+d*4+e*5,
       b-c,
       a+b*2,
       d-e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (e>a AND e<b)
 ORDER BY 3,4,1,5,6,2,7
----
223
444
2
3331
-1
666
1
118
333
3
1757
-1
351
-1
194
444
3
2878
1
579
-2

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3,
       a,
       a-b,
       d
  FROM t1
 WHERE (e>a AND e<b)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 6,1,2,3,5,4
----
222
0
1338
220
-3
222
247
0
1484
245
-4
248

query I nosort
SELECT c-d
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
-4
-3
-3
-3
-3
-2
-2
-2
-2
-1
-1
-1
-1
1
1
1
1
1
1
1
1
2
2
2
3
3
3

query IIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       d-e,
       abs(a),
       c-d
  FROM t1
 ORDER BY 2,3,4,1
----
2131
-4
142
1
2806
-4
188
2
1529
-2
104
1
2579
-2
174
1
2878
-2
191
3
3114
-2
205
1
3260
-2
216
-2
1612
-1
107
-2
1757
-1
115
3
2349
-1
159
-1
2949
-1
199
-1
3039
-1
201
-1
3399
-1
229
-1
3629
-1
243
3
1985
1
131
1
2046
1
138
1
2654
1
179
-2
3331
1
220
2
3553
1
239
-3
1826
2
121
1
1902
2
127
-3
2202
2
149
-1
2281
2
153
-4
2432
2
163
-3
3175
2
213
2
3706
2
245
-1
2728
3
182
1
3473
3
234
-2
1680
4
111
-1
2501
4
168
-3

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       c
  FROM t1
 WHERE d>e
    OR (e>c OR e<d)
 ORDER BY 2,1
----
1529
102
1612
106
1680
113
1826
123
1902
125
1985
134
2046
137
2131
141
2202
147
2281
150
2349
155
2432
161
2501
166
2579
172
2654
176
2728
184
2806
187
2949
195
3039
202
3114
208
3175
214
3260
215
3331
224
3399
225
3473
231
3553
235
3706
247

query III nosort
SELECT a,
       a+b*2+c*3+d*4,
       d
  FROM t1
 ORDER BY 1,3,2
----
104
1014
101
107
1067
108
111
1130
114
115
1172
116
121
1226
122
127
1272
128
131
1325
133
138
1371
136
142
1411
140
149
1472
148
153
1521
154
159
1564
156
163
1622
164
168
1676
169
174
1714
171
179
1769
178
182
1828
183
188
1861
185
191
1918
190
199
1964
196
201
2019
203
205
2069
207
213
2125
212
216
2165
217
220
2226
222
229
2264
226
234
2323
233
239
2368
238
243
2419
241
245
2476
248

query IIIII nosort
SELECT b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e,
       abs(a),
       (a+b+c+d+e)/5
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR e+d BETWEEN a+b-10 AND c+130
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,2,1,5,4
----
143
111
-4
142
142
186
444
-4
188
187
206
111
-2
205
207
218
333
-2
216
217
194
444
-2
191
192
100
555
-2
104
102
170
555
-2
174
172
200
222
-1
201
202
240
222
-1
243
242
105
333
-1
107
107
118
333
-1
115
117
158
555
-1
159
157
198
555
-1
199
197
228
555
-1
229
227
139
111
1
138
137
130
444
1
131
132
223
444
1
220
222
175
555
1
179
177
236
555
1
239
237
211
222
2
213
212
124
333
2
121
122
129
333
2
127
127
151
333
2
153
152
160
333
2
163
162
249
444
2
245
247
145
555
2
149
147
181
333
3
182
182
232
555
3
234
232
112
111
4
111
112
167
333
4
168
167

query IIIIIII nosort
SELECT a-b,
       (a+b+c+d+e)/5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(a),
       d-e,
       abs(b-c),
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 6,4,5,3,1,2,7
----
2
107
333
107
-1
1
1067
-1
112
111
111
4
1
1130
-3
117
333
115
-1
1
1172
-3
122
333
121
2
1
1226
2
152
333
153
2
1
1521
3
162
333
163
2
1
1622
1
167
333
168
4
1
1676
4
177
555
179
1
1
1769
2
187
444
188
-4
1
1861
-3
192
444
191
-2
1
1918
-3
222
444
220
1
1
2226
2
232
555
234
3
1
2323
3
237
555
239
1
1
2368
4
102
555
104
-2
2
1014
-1
137
111
138
1
2
1371
-1
142
111
142
-4
2
1411
4
147
555
149
2
2
1472
4
172
555
174
-2
2
1714
1
202
222
201
-1
2
2019
-1
207
111
205
-2
2
2069
-4
247
444
245
2
2
2476
1
157
555
159
-1
3
1564
1
182
333
182
3
3
1828
1
197
555
199
-1
3
1964
2
212
222
213
2
3
2125
-2
217
333
216
-2
3
2165
1
227
555
229
-1
3
2264
-2
127
333
127
2
4
1272
1
132
444
131
1
4
1325
3
242
222
243
-1
4
2419

query I nosort
SELECT d
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----
101
108
114
116
122
128

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       d-e,
       abs(a),
       a-b,
       b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE c>d
 ORDER BY 5,4,3,2,1,6
----
1529
-2
104
4
100
555
1757
-1
115
-3
118
333
1826
2
121
-3
124
333
1985
1
131
1
130
444
2046
1
138
-1
139
111
2131
-4
142
-1
143
111
2579
-2
174
4
170
555
2728
3
182
1
181
333
2806
-4
188
2
186
444
2878
-2
191
-3
194
444
3114
-2
205
-1
206
111
3175
2
213
2
211
222
3331
1
220
-3
223
444
3629
-1
243
3
240
222

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE c>d
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----
1529
1612
1680
1757
1826
1902
1985
2046
2131
2579
2728
2806
2878
3114
3175
3331
3629

query I nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE d>e
    OR (e>a AND e<b)
 ORDER BY 1
----
111
222
222
222
222
222
222
222
333
333
333
333
333
333
444
444
444
444

query III nosort
SELECT c-d,
       a+b*2+c*3,
       a
  FROM t1
 ORDER BY 1,2,3
----
-4
905
153
-3
760
127
-3
966
163
-3
1000
168
-3
1416
239
-2
635
107
-2
1057
179
-2
1297
216
-2
1391
234
-1
674
111
-1
880
149
-1
940
159
-1
1180
199
-1
1207
201
-1
1360
229
-1
1484
245
1
610
104
1
738
121
1
793
131
1
827
138
1
851
142
1
1030
174
1
1096
182
1
1241
205
2
1121
188
2
1277
213
2
1338
220
3
708
115
3
1158
191
3
1455
243

query II nosort
SELECT (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c>d
   AND b>c
   AND (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
137
222
142
222

query III nosort
SELECT a,
       abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR d NOT BETWEEN 110 AND 150
    OR (e>c OR e<d)
 ORDER BY 2,1,3
----
104
104
444
107
107
333
111
111
222
121
121
222
127
127
222
131
131
333
138
138
222
142
142
222
149
149
444
153
153
333
159
159
333
163
163
444
168
168
333
174
174
444
179
179
444
182
182
333
188
188
333
191
191
222
199
199
333
201
201
333
205
205
222
213
213
333
216
216
222
220
220
222
229
229
333
234
234
333
239
239
444
243
243
444
245
245
111

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1
----
1529
1612
1680
1826
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2949
3039
3114
3175
3331
3399
3473
3553
3706

query I nosort
SELECT abs(b-c)
  FROM t1
 WHERE c>d
   AND d NOT BETWEEN 110 AND 150
   AND a>b
 ORDER BY 1
----
1
2
2
3
3
4

query IIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a
  FROM t1
 ORDER BY 4,2,3,1
----
1000
0
444
104
1050
0
333
107
1120
0
222
111
1180
0
222
115
1240
0
222
121
1290
0
222
127
1300
0
333
131
1390
0
222
138
1430
0
222
142
1450
0
444
149
1510
0
333
153
1580
0
333
159
1600
0
444
163
1670
0
333
168
1700
0
444
174
358
0
444
179
364
0
333
182
376
0
333
188
382
0
222
191
398
0
333
199
402
0
333
201
410
0
222
205
426
0
333
213
432
0
222
216
440
0
222
220
458
0
333
229
468
0
333
234
478
0
444
239
486
0
444
243
490
0
111
245

query IIIIIII nosort
SELECT e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4,
       a+b*2+c*3,
       c-d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE c>d
 ORDER BY 1,2,5,3,4,7,6
----
103
444
1014
610
1
1000
555
117
222
1172
708
3
1180
333
120
222
1226
738
1
1240
333
132
333
1325
793
1
1300
444
135
222
1371
827
1
1390
111
144
222
1411
851
1
1430
111
173
444
1714
1030
1
1700
555
180
333
1828
1096
1
364
333
189
333
1861
1121
2
376
444
192
222
1918
1158
3
382
444
209
222
2069
1241
1
410
111
210
333
2125
1277
2
426
222
221
222
2226
1338
2
440
444
242
444
2419
1455
3
486
222

query III nosort
SELECT abs(a),
       a-b,
       a+b*2+c*3
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 3,1,2
----
111
-1
674
131
1
793
138
-1
827
142
-1
851
159
1
940
168
1
1000
182
1
1096
199
1
1180
201
1
1207
205
-1
1241
229
1
1360

query IIII nosort
SELECT a-b,
       abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,2,4,1
----
-1
111
111
1120
-1
138
111
1390
-1
142
111
1430
-1
205
111
410
1
201
222
402
2
213
222
426
2
107
333
1050
-3
121
333
1240
-2
127
333
1290
2
153
333
1510
3
163
333
1600
1
168
333
1670
1
182
333
364
-2
216
333
432
1
131
444
1300
2
188
444
376
-3
220
444
440
-4
245
444
490
4
104
555
1000
4
149
555
1450
1
159
555
1580
4
174
555
1700
4
179
555
358
1
199
555
398
1
229
555
458
2
234
555
468
3
239
555
478

query III nosort
SELECT b-c,
       c-d,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE a>b
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,3
----
-4
1
1985
-4
3
3629
-3
1
2728
-3
2
3175
-2
-1
2202
-2
-1
3039
-2
1
1529
-2
1
2579
-2
1
3114
-1
-3
2432
-1
-2
1612
-1
-2
2654
-1
2
2806
-1
2
3331
1
-4
2281
1
-3
2501
1
-3
3553
1
-2
3473
1
3
2878
2
-1
3706
3
-2
3260
3
-1
2349
3
-1
2949
3
-1
3399

query IIII nosort
SELECT b,
       a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (e>c OR e<d)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 1,3,2,4
----
100
610
1000
1
105
635
1050
-2
112
674
1120
-1
118
708
1180
3
124
738
1240
1
129
760
1290
-3
130
793
1300
1
139
827
1390
1
143
851
1430
1
145
880
1450
-1
151
905
1510
-4
158
940
1580
-1
160
966
1600
-3
167
1000
1670
-3
170
1030
1700
1
175
1057
358
-2
181
1096
364
1
186
1121
376
2
194
1158
382
3
198
1180
398
-1
200
1207
402
-1
206
1241
410
1
211
1277
426
2
218
1297
432
-2
223
1338
440
2
228
1360
458
-1
232
1391
468
-2
236
1416
478
-3
240
1455
486
3
249
1484
490
-1

query II nosort
SELECT a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c>d
   AND b>c
 ORDER BY 2,1
----
-3
222
-3
222
-1
222
-1
222

query IIII nosort
SELECT c-d,
       b-c,
       abs(b-c),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,3,4,2
----
-3
4
4
1290
-2
-1
1
1050
-1
-1
1
1120
1
1
1
1240
1
-2
2
1000
3
-1
1
1180

query IIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       a+b*2+c*3
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 3,4,2,1
----
1529
1000
100
610
1612
1050
105
635
1680
1120
112
674
1826
1240
124
738
1985
1300
130
793
2046
1390
139
827
2131
1430
143
851
2202
1450
145
880
2281
1510
151
905
2432
1600
160
966
2501
1670
167
1000
2579
1700
170
1030
2654
358
175
1057
2728
364
181
1096
2806
376
186
1121
3039
402
200
1207
3114
410
206
1241
3175
426
211
1277
3331
440
223
1338
3473
468
232
1391
3553
478
236
1416
3706
490
249
1484

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       c,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 4,2,3,1,5,6
----
3
222
116
119
1757
0
18
222
190
193
2878
0
24
222
222
224
3331
0
29
111
248
247
3706
0

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 1
----
0
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

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c),
       abs(a),
       a+b*2,
       a,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e
  FROM t1
 WHERE (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 4,2,3,7,1,5,6
----
18
1
191
579
191
222
192
24
1
220
666
220
222
221
29
2
245
743
245
111
246

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(a),
       c,
       d
  FROM t1
 WHERE (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 2,1,5,3,4
----
382
444
191
193
190
440
444
220
224
222
490
444
245
247
248

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c,
       e
  FROM t1
 WHERE d>e
 ORDER BY 2,5,1,4,3
----
3706
-4
111
247
246
1826
-3
222
123
120
3331
-3
222
224
221
1902
-2
222
125
126
1680
-1
222
113
110
2046
-1
222
137
135
1985
1
333
134
132
2501
1
333
166
165
2728
1
333
184
180
2281
2
333
150
152
3175
2
333
214
210
3473
2
333
231
230
2432
3
444
161
162
3553
3
444
235
237
2202
4
444
147
146
2654
4
444
176
177

query IIIIII nosort
SELECT e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5,
       b,
       d-e,
       c
  FROM t1
 WHERE c>d
   AND d>e
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,4,1,5,3,6
----
120
0
1826
124
2
123
132
0
1985
130
1
134
135
0
2046
139
1
137
180
0
2728
181
3
184
210
0
3175
211
2
214
221
0
3331
223
1
224

query IIIII nosort
SELECT a+b*2+c*3+d*4,
       abs(b-c),
       a+b*2+c*3,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a)
  FROM t1
 WHERE d>e
 ORDER BY 3,4,1,5,2
----
1130
1
674
222
111
1226
1
738
222
121
1272
4
760
222
127
1325
4
793
333
131
1371
2
827
222
138
1472
2
880
444
149
1521
1
905
333
153
1622
1
966
444
163
1676
1
1000
333
168
1769
1
1057
444
179
1828
3
1096
333
182
2125
3
1277
333
213
2226
1
1338
222
220
2323
1
1391
333
234
2368
1
1416
444
239
2476
2
1484
111
245

query III nosort
SELECT b-c,
       d-e,
       abs(a)
  FROM t1
 ORDER BY 1,3,2
----
-4
1
131
-4
-1
243
-3
3
182
-3
2
213
-2
-2
104
-2
2
149
-2
-2
174
-2
-1
201
-2
-2
205
-1
-1
107
-1
4
111
-1
-1
115
-1
2
163
-1
1
179
-1
-4
188
-1
1
220
1
2
121
1
2
153
1
4
168
1
-2
191
1
3
234
1
1
239
2
1
138
2
-4
142
2
2
245
3
-1
159
3
-1
199
3
-2
216
3
-1
229
4
2
127

query I nosort
SELECT e
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (c<=d-2 OR c>=d+2)
   AND (e>c OR e<d)
 ORDER BY 1
----
109
126
152
162
165
177
189
210
219
221
230
237

query I nosort
SELECT d
  FROM t1
 ORDER BY 1
----
101
108
114
116
122
128
133
136
140
148
154
156
164
169
171
178
183
185
190
196
203
207
212
217
222
226
233
238
241
248

query IIIII nosort
SELECT a+b*2,
       abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3,
       c-d
  FROM t1
 ORDER BY 4,1,5,3,2
----
304
104
1000
610
1
317
107
1050
635
-2
335
111
1120
674
-1
351
115
1180
708
3
369
121
1240
738
1
385
127
1290
760
-3
391
131
1300
793
1
416
138
1390
827
1
428
142
1430
851
1
439
149
1450
880
-1
455
153
1510
905
-4
475
159
1580
940
-1
483
163
1600
966
-3
502
168
1670
1000
-3
514
174
1700
1030
1
529
179
358
1057
-2
544
182
364
1096
1
560
188
376
1121
2
579
191
382
1158
3
595
199
398
1180
-1
601
201
402
1207
-1
617
205
410
1241
1
635
213
426
1277
2
652
216
432
1297
-2
666
220
440
1338
2
685
229
458
1360
-1
698
234
468
1391
-2
711
239
478
1416
-3
723
243
486
1455
3
743
245
490
1484
-1

query IIIII nosort
SELECT c-d,
       e,
       a+b*2,
       b,
       abs(a)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR (e>c OR e<d)
 ORDER BY 2,5,3,1,4
----
1
103
304
100
104
-2
109
317
105
107
-1
110
335
112
111
1
120
369
124
121
-3
126
385
129
127
1
132
391
130
131
1
135
416
139
138
1
144
428
143
142
-1
146
439
145
149
-4
152
455
151
153
-1
157
475
158
159
-3
162
483
160
163
-3
165
502
167
168
1
173
514
170
174
-2
177
529
175
179
1
180
544
181
182
2
189
560
186
188
3
192
579
194
191
-1
197
595
198
199
-1
204
601
200
201
1
209
617
206
205
2
210
635
211
213
-2
219
652
218
216
2
221
666
223
220
-1
227
685
228
229
-2
230
698
232
234
-3
237
711
236
239
3
242
723
240
243
-1
246
743
249
245

query IIIIIII nosort
SELECT e,
       abs(a),
       c-d,
       a,
       c,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 2,7,6,5,3,1,4
----
103
104
1
104
102
1529
0
109
107
-2
107
106
1612
0
110
111
-1
111
113
1680
0
120
121
1
121
123
1826
0
132
131
1
131
134
1985
0
135
138
1
138
137
2046
0
144
142
1
142
141
2131
0
146
149
-1
149
147
2202
0
152
153
-4
153
150
2281
0
162
163
-3
163
161
2432
0
165
168
-3
168
166
2501
0
173
174
1
174
172
2579
0
177
179
-2
179
176
2654
0
180
182
1
182
184
2728
0
189
188
2
188
187
2806
0
204
201
-1
201
202
3039
0
209
205
1
205
208
3114
0
210
213
2
213
214
3175
0
221
220
2
220
224
3331
0
230
234
-2
234
231
3473
0
237
239
-3
239
235
3553
0
246
245
-1
245
247
3706
0

query I nosort
SELECT a+b*2+c*3
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR e+d BETWEEN a+b-10 AND c+130
    OR (e>c OR e<d)
 ORDER BY 1
----
610
635
674
708
738
760
793
827
851
880
905
940
966
1000
1030
1057
1096
1121
1158
1180
1207
1241
1277
1297
1338
1360
1391
1416
1455
1484

query IIII nosort
SELECT e,
       a-b,
       c,
       a
  FROM t1
 ORDER BY 1,4,2,3
----
103
4
102
104
109
2
106
107
110
-1
113
111
117
-3
119
115
120
-3
123
121
126
-2
125
127
132
1
134
131
135
-1
137
138
144
-1
141
142
146
4
147
149
152
2
150
153
157
1
155
159
162
3
161
163
165
1
166
168
173
4
172
174
177
4
176
179
180
1
184
182
189
2
187
188
192
-3
193
191
197
1
195
199
204
1
202
201
209
-1
208
205
210
2
214
213
219
-2
215
216
221
-3
224
220
227
1
225
229
230
2
231
234
237
3
235
239
242
3
244
243
246
-4
247
245

query IIIIII nosort
SELECT a+b*2,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND d NOT BETWEEN 110 AND 150
   AND c>d
 ORDER BY 3,4,6,5,1,2
----
560
189
17
2
-1
444
579
192
18
-3
1
444
635
210
22
2
-3
222
666
221
24
-3
-1
444
723
242
28
3
-4
222

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(b-c),
       e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a),
       a
  FROM t1
 WHERE d>e
   AND b>c
   AND c BETWEEN b-2 AND d+2
 ORDER BY 4,3,6,1,2,5
----
3706
2
246
111
245
245
1826
1
120
222
121
121
2046
2
135
222
138
138
2281
1
152
333
153
153
2501
1
165
333
168
168
3473
1
230
333
234
234
3553
1
237
444
239
239

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4,
       a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 2,5,3,6,4,1
----
333
1
3
1172
-3
222
333
1
4
1226
-3
222
444
1
18
1918
-3
222
444
1
24
2226
-3
222
111
1
2
1130
-1
222
333
1
13
1676
1
333
333
1
1
1067
2
333
333
1
10
1521
2
333
444
1
17
1861
2
333
555
1
26
2323
2
333
333
1
12
1622
3
444
555
1
27
2368
3
444
555
1
15
1769
4
444
444
2
29
2476
-4
111
111
2
7
1371
-1
222
111
2
8
1411
-1
222
111
2
21
2069
-1
222
222
2
20
2019
1
333
555
2
0
1014
4
444
555
2
9
1472
4
444
555
2
14
1714
4
444
333
3
23
2165
-2
222
555
3
11
1564
1
333
333
3
16
1828
1
333
555
3
19
1964
1
333
555
3
25
2264
1
333
222
3
22
2125
2
333
333
4
5
1272
-2
222
444
4
6
1325
1
333
222
4
28
2419
3
444

query IIII nosort
SELECT abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e,
       a-b
  FROM t1
 ORDER BY 1,3,4,2
----
1
0
-4
2
1
0
-2
-3
1
0
-1
-3
1
0
-1
2
1
0
1
-3
1
0
1
3
1
0
1
4
1
0
2
-3
1
0
2
2
1
0
2
3
1
0
3
2
1
0
4
-1
1
0
4
1
2
0
-4
-1
2
0
-2
-1
2
0
-2
4
2
0
-2
4
2
0
-1
1
2
0
1
-1
2
0
2
-4
2
0
2
4
3
0
-2
-2
3
0
-1
1
3
0
-1
1
3
0
-1
1
3
0
2
2
3
0
3
1
4
0
-1
3
4
0
1
1
4
0
2
-2

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4,
       d-e
  FROM t1
 ORDER BY 3,1,2
----
222
1411
-4
333
1861
-4
222
1918
-2
222
2069
-2
222
2165
-2
444
1014
-2
444
1714
-2
222
1172
-1
333
1067
-1
333
1564
-1
333
1964
-1
333
2019
-1
333
2264
-1
444
2419
-1
222
1371
1
222
2226
1
333
1325
1
444
1769
1
444
2368
1
111
2476
2
222
1226
2
222
1272
2
333
1521
2
333
2125
2
444
1472
2
444
1622
2
333
1828
3
333
2323
3
222
1130
4
333
1676
4

query IIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 4,3,2,1
----
1180
118
-3
222
1240
124
-3
222
1290
129
-2
222
1120
112
-1
222
1050
105
2
333
1000
100
4
444

query III nosort
SELECT abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 3,1,2
----
115
3
222
127
5
222
191
18
222
216
23
222
220
24
222
107
1
333
153
10
333
168
13
333
188
17
333
213
22
333
234
26
333
163
12
444
179
15
444
239
27
444
243
28
444

query IIIII nosort
SELECT a-b,
       abs(a),
       a,
       e,
       b-c
  FROM t1
 ORDER BY 2,4,3,1,5
----
4
104
104
103
-2
2
107
107
109
-1
-1
111
111
110
-1
-3
115
115
117
-1
-3
121
121
120
1
-2
127
127
126
4
1
131
131
132
-4
-1
138
138
135
2
-1
142
142
144
2
4
149
149
146
-2
2
153
153
152
1
1
159
159
157
3
3
163
163
162
-1
1
168
168
165
1
4
174
174
173
-2
4
179
179
177
-1
1
182
182
180
-3
2
188
188
189
-1
-3
191
191
192
1
1
199
199
197
3
1
201
201
204
-2
-1
205
205
209
-2
2
213
213
210
-3
-2
216
216
219
3
-3
220
220
221
-1
1
229
229
227
3
2
234
234
230
1
3
239
239
237
1
3
243
243
242
-4
-4
245
245
246
2

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR b>c
    OR d>e
 ORDER BY 3,2,1
----
333
107
1
222
112
2
222
117
3
222
122
4
222
127
5
333
132
6
222
137
7
222
142
8
444
147
9
333
152
10
333
157
11
444
162
12
333
167
13
444
177
15
333
182
16
333
187
17
222
192
18
333
197
19
333
212
22
222
217
23
222
222
24
333
227
25
333
232
26
444
237
27
444
242
28
111
247
29

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b,
       d-e
  FROM t1
 ORDER BY 1,4,3,2
----
0
1430
-1
-4
0
376
2
-4
0
382
-3
-2
0
432
-2
-2
0
410
-1
-2
0
1000
4
-2
0
1700
4
-2
0
1180
-3
-1
0
398
1
-1
0
402
1
-1
0
458
1
-1
0
1580
1
-1
0
1050
2
-1
0
486
3
-1
0
440
-3
1
0
1390
-1
1
0
1300
1
1
0
478
3
1
0
358
4
1
0
490
-4
2
0
1240
-3
2
0
1290
-2
2
0
426
2
2
0
1510
2
2
0
1600
3
2
0
1450
4
2
0
364
1
3
0
468
2
3
0
1120
-1
4
0
1670
1
4

query III nosort
SELECT (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,2,1
----
102
444
102
107
333
106
112
222
113
117
222
119
122
222
123
127
222
125
152
333
150
162
444
161
167
333
166
177
444
176
187
333
187
192
222
193
212
333
214
217
222
215
222
222
224
232
333
231
237
444
235
242
444
244

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a-b,
       (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 4,1,3,5,2
----
1120
0
-1
112
222
1300
0
1
132
333
1390
0
-1
137
222
1430
0
-1
142
222
1580
0
1
157
333
1670
0
1
167
333
364
0
1
182
333
398
0
1
197
333
402
0
1
202
333
410
0
-1
207
222
458
0
1
227
333

query III nosort
SELECT (a+b+c+d+e)/5,
       e,
       a-b
  FROM t1
 ORDER BY 3,1,2
----
247
246
-4
117
117
-3
122
120
-3
192
192
-3
222
221
-3
127
126
-2
217
219
-2
112
110
-1
137
135
-1
142
144
-1
207
209
-1
132
132
1
157
157
1
167
165
1
182
180
1
197
197
1
202
204
1
227
227
1
107
109
2
152
152
2
187
189
2
212
210
2
232
230
2
162
162
3
237
237
3
242
242
3
102
103
4
147
146
4
172
173
4
177
177
4

query III nosort
SELECT b-c,
       c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR (e>c OR e<d)
 ORDER BY 1,2,3
----
-4
134
444
-3
184
333
-3
214
222
-2
102
555
-2
147
555
-2
172
555
-2
202
222
-2
208
111
-1
106
333
-1
113
111
-1
161
333
-1
176
555
-1
187
444
-1
224
444
1
123
333
1
150
333
1
166
333
1
231
555
1
235
555
2
137
111
2
141
111
2
247
444
3
155
555
3
195
555
3
215
333
3
225
555
4
125
333

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e,
       d
  FROM t1
 WHERE b>c
 ORDER BY 6,2,5,4,3,1
----
1826
121
222
0
120
122
1902
127
222
0
126
128
2046
138
222
0
135
136
2131
142
222
0
144
140
2281
153
333
0
152
154
2349
159
333
0
157
156
2501
168
333
0
165
169
2878
191
222
0
192
190
2949
199
333
0
197
196
3260
216
222
0
219
217
3399
229
333
0
227
226
3473
234
333
0
230
233
3553
239
444
0
237
238
3706
245
111
0
246
248

query I nosort
SELECT d
  FROM t1
 ORDER BY 1
----
101
108
114
116
122
128
133
136
140
148
154
156
164
169
171
178
183
185
190
196
203
207
212
217
222
226
233
238
241
248

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (e>a AND e<b)
   AND (a>b-2 AND a<b+2)
   AND b>c
 ORDER BY 1,3,2
----

query IIIIII nosort
SELECT abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d,
       b-c,
       b,
       (a+b+c+d+e)/5
  FROM t1
 WHERE b>c
   AND c BETWEEN b-2 AND d+2
 ORDER BY 4,2,5,6,1,3
----
234
468
-2
1
232
232
239
478
-3
1
236
237
121
1240
1
1
124
122
153
1510
-4
1
151
152
168
1670
-3
1
167
167
245
490
-1
2
249
247
138
1390
1
2
139
137
142
1430
1
2
143
142

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a+b*2,
       a+b*2+c*3+d*4,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR b>c
    OR (e>a AND e<b)
 ORDER BY 6,5,4,2,1,3
----
1680
335
1130
111
1
2
1757
351
1172
333
1
3
1826
369
1226
333
1
4
1902
385
1272
333
4
5
1985
391
1325
444
4
6
2046
416
1371
111
2
7
2131
428
1411
111
2
8
2281
455
1521
333
1
10
2349
475
1564
555
3
11
2501
502
1676
333
1
13
2728
544
1828
333
3
16
2878
579
1918
444
1
18
2949
595
1964
555
3
19
3039
601
2019
222
2
20
3114
617
2069
111
2
21
3260
652
2165
333
3
23
3331
666
2226
444
1
24
3399
685
2264
555
3
25
3473
698
2323
555
1
26
3553
711
2368
555
1
27
3706
743
2476
444
2
29

query I nosort
SELECT abs(b-c)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND c>d
   AND (a>b-2 AND a<b+2)
 ORDER BY 1
----

query II nosort
SELECT a-b,
       d-e
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
-1
-4
-1
-2
1
-1
1
-1
1
-1
1
-1
-1
1
1
1
1
3
-1
4
1
4

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b,
       b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE b>c
    OR a>b
    OR (a>b-2 AND a<b+2)
 ORDER BY 3,2,4,1,5
----
1529
0
100
-2
444
1612
1
105
-1
333
1680
2
112
-1
222
1826
4
124
1
222
1902
5
129
4
222
1985
6
130
-4
333
2046
7
139
2
222
2131
8
143
2
222
2202
9
145
-2
444
2281
10
151
1
333
2349
11
158
3
333
2432
12
160
-1
444
2501
13
167
1
333
2579
14
170
-2
444
2654
15
175
-1
444
2728
16
181
-3
333
2806
17
186
-1
333
2878
18
194
1
222
2949
19
198
3
333
3039
20
200
-2
333
3114
21
206
-2
222
3175
22
211
-3
333
3260
23
218
3
222
3399
25
228
3
333
3473
26
232
1
333
3553
27
236
1
444
3629
28
240
-4
444
3706
29
249
2
111

query IIII nosort
SELECT a+b*2+c*3,
       d-e,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,4,3
----
610
-2
102
0
635
-1
106
0
905
2
150
0
940
-1
155
0
966
2
161
0
1000
4
166
0
1030
-2
172
0
1057
1
176
0
1096
3
184
0
1121
-4
187
0
1158
-2
193
0
1180
-1
195
0
1207
-1
202
0
1241
-2
208
0
1277
2
214
0
1297
-2
215
0
1338
1
224
0
1360
-1
225
0
1391
3
231
0
1416
1
235
0
1455
-1
244
0
1484
2
247
0

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 2,1
----
0
111
0
111
0
111
0
111
0
222
0
222
0
222
0
333
0
333
0
333
0
333
0
333
0
333
0
333
0
333
0
333
0
444
0
444
0
444
0
444
0
444
0
555
0
555
0
555
0
555
0
555
0
555
0
555
0
555
0
555

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND c>d
   AND d>e
 ORDER BY 1
----
1828
2125
2226

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       a+b*2+c*3
  FROM t1
 ORDER BY 4,2,1,3,5,6
----
0
-2
176
358
175
1057
0
1
184
364
181
1096
0
2
187
376
186
1121
0
3
193
382
194
1158
0
-1
195
398
198
1180
0
-1
202
402
200
1207
0
1
208
410
206
1241
0
2
214
426
211
1277
0
-2
215
432
218
1297
0
2
224
440
223
1338
0
-1
225
458
228
1360
0
-2
231
468
232
1391
0
-3
235
478
236
1416
0
3
244
486
240
1455
0
-1
247
490
249
1484
0
1
102
1000
100
610
0
-2
106
1050
105
635
0
-1
113
1120
112
674
0
3
119
1180
118
708
0
1
123
1240
124
738
0
-3
125
1290
129
760
0
1
134
1300
130
793
0
1
137
1390
139
827
0
1
141
1430
143
851
0
-1
147
1450
145
880
0
-4
150
1510
151
905
0
-1
155
1580
158
940
0
-3
161
1600
160
966
0
-3
166
1670
167
1000
0
1
172
1700
170
1030

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       abs(a),
       d,
       c,
       abs(b-c)
  FROM t1
 WHERE a>b
    OR b>c
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,1,3,6,4,5
----
29
-4
245
248
247
2
3
-3
115
116
119
1
4
-3
121
122
123
1
18
-3
191
190
193
1
5
-2
127
128
125
4
23
-2
216
217
215
3
2
-1
111
114
113
1
7
-1
138
136
137
2
8
-1
142
140
141
2
6
1
131
133
134
4
11
1
159
156
155
3
13
1
168
169
166
1
16
1
182
183
184
3
19
1
199
196
195
3
20
1
201
203
202
2
25
1
229
226
225
3
1
2
107
108
106
1
10
2
153
154
150
1
17
2
188
185
187
1
22
2
213
212
214
3
26
2
234
233
231
1
12
3
163
164
161
1
27
3
239
238
235
1
28
3
243
241
244
4
0
4
104
101
102
2
9
4
149
148
147
2
14
4
174
171
172
2
15
4
179
178
176
1

query II nosort
SELECT a,
       c-d
  FROM t1
 ORDER BY 1,2
----
104
1
107
-2
111
-1
115
3
121
1
127
-3
131
1
138
1
142
1
149
-1
153
-4
159
-1
163
-3
168
-3
174
1
179
-2
182
1
188
2
191
3
199
-1
201
-1
205
1
213
2
216
-2
220
2
229
-1
234
-2
239
-3
243
3
245
-1

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 ORDER BY 1
----
102
107
112
117
122
127
132
137
142
147
152
157
162
167
172
177
182
187
192
197
202
207
212
217
222
227
232
237
242
247

query II nosort
SELECT a+b*2+c*3,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND a>b
 ORDER BY 1,2
----
610
555
635
333
905
333
940
555
966
333
1000
333
1030
555
1057
555
1096
333
1121
444
1180
555
1207
222
1277
222
1360
555
1391
555
1416
555
1455
222

query I nosort
SELECT abs(b-c)
  FROM t1
 WHERE b>c
 ORDER BY 1
----
1
1
1
1
1
1
2
2
2
3
3
3
3
4

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c
  FROM t1
 WHERE b>c
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 2,1
----
486
-4
364
-3
426
-3
402
-2
410
-2
1000
-2
1700
-2
358
-1
376
-1
440
-1
1050
-1
1600
-1
382
1
468
1
478
1
1240
1
1510
1
1670
1
490
2
1390
2
1430
2
398
3
432
3
458
3
1580
3
1290
4

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(a)
  FROM t1
 WHERE d>e
   AND b>c
 ORDER BY 2,1
----
1826
121
1902
127
2046
138
2281
153
2501
168
3473
234
3553
239
3706
245

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e,
       a,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>c OR e<d)
   AND c>d
 ORDER BY 1,5,2,6,3,4
----
111
416
222
135
138
2046
111
428
222
144
142
2131
111
617
222
209
205
3114
222
635
333
210
213
3175
333
369
222
120
121
1826
333
544
333
180
182
2728
444
391
333
132
131
1985
444
560
333
189
188
2806
444
666
222
221
220
3331
555
304
444
103
104
1529
555
514
444
173
174
2579

query IIII nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b,
       a-b
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (a>b-2 AND a<b+2)
 ORDER BY 1,3,2,4
----
107
1
105
2
111
2
112
-1
115
3
118
-3
121
4
124
-3
127
5
129
-2
131
6
130
1
138
7
139
-1
142
8
143
-1
149
9
145
4
153
10
151
2
159
11
158
1
163
12
160
3
168
13
167
1
174
14
170
4
179
15
175
4
182
16
181
1
188
17
186
2
191
18
194
-3
199
19
198
1
201
20
200
1
205
21
206
-1
213
22
211
2
216
23
218
-2
220
24
223
-3
229
25
228
1
234
26
232
2
239
27
236
3
243
28
240
3
245
29
249
-4

query III nosort
SELECT a,
       a+b*2+c*3,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR c>d
 ORDER BY 1,2,3
----
104
610
1529
107
635
1612
111
674
1680
115
708
1757
121
738
1826
127
760
1902
131
793
1985
138
827
2046
142
851
2131
174
1030
2579
182
1096
2728
188
1121
2806
191
1158
2878
205
1241
3114
213
1277
3175
220
1338
3331
243
1455
3629

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1
----
1014
1067
1521
1564
1622
1676
1714
1769
1828
1861
1918
1964
2019
2069
2125
2165
2226
2264
2323
2368
2419
2476

query IIIII nosort
SELECT c-d,
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4,
       d
  FROM t1
 WHERE c>d
   AND (e>c OR e<d)
 ORDER BY 3,1,4,5,2
----
1
104
0
1014
101
1
121
0
1226
122
1
131
0
1325
133
1
138
0
1371
136
1
142
0
1411
140
1
174
0
1714
171
1
182
0
1828
183
1
205
0
2069
207
2
188
0
1861
185
2
213
0
2125
212
2
220
0
2226
222

query IIIII nosort
SELECT c-d,
       a+b*2+c*3+d*4+e*5,
       abs(b-c),
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (a>b-2 AND a<b+2)
   AND (e>c OR e<d)
 ORDER BY 4,1,3,2,5
----
1
2131
2
-4
8
1
3114
2
-2
21
-1
3039
2
-1
20
1
2046
2
1
7
1
1985
4
1
6
1
2728
3
3
16
-3
2501
1
4
13
-1
1680
1
4
2

query IIIII nosort
SELECT c,
       a+b*2+c*3,
       c-d,
       abs(b-c),
       d-e
  FROM t1
 ORDER BY 3,4,1,2,5
----
150
905
-4
1
2
161
966
-3
1
2
166
1000
-3
1
4
235
1416
-3
1
1
125
760
-3
4
2
106
635
-2
1
-1
176
1057
-2
1
1
231
1391
-2
1
3
215
1297
-2
3
-2
113
674
-1
1
4
147
880
-1
2
2
202
1207
-1
2
-1
247
1484
-1
2
2
155
940
-1
3
-1
195
1180
-1
3
-1
225
1360
-1
3
-1
123
738
1
1
2
102
610
1
2
-2
137
827
1
2
1
141
851
1
2
-4
172
1030
1
2
-2
208
1241
1
2
-2
184
1096
1
3
3
134
793
1
4
1
187
1121
2
1
-4
224
1338
2
1
1
214
1277
2
3
2
119
708
3
1
-1
193
1158
3
1
-2
244
1455
3
4
-1

query III nosort
SELECT (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 1,3,2
----
102
0
0
107
1
0
112
2
0
117
3
0
122
4
0
127
5
0
132
6
0
137
7
0
142
8
0
147
9
0
152
10
0
157
11
0
162
12
0
167
13
0
172
14
0
177
15
0
182
16
0
187
17
0
192
18
0
197
19
0
202
20
0
207
21
0
212
22
0
217
23
0
222
24
0
227
25
0
232
26
0
237
27
0
242
28
0
247
29
0

query II nosort
SELECT e,
       d-e
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR d>e
    OR (e>a AND e<b)
 ORDER BY 1,2
----
103
-2
109
-1
110
4
117
-1
120
2
126
2
132
1
135
1
144
-4
146
2
152
2
162
2
165
4
173
-2
177
1
180
3
189
-4
192
-2
204
-1
209
-2
210
2
221
1
230
3
237
1
246
2

query IIIIII nosort
SELECT c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (a+b+c+d+e)/5,
       b-c,
       e,
       c-d
  FROM t1
 ORDER BY 5,4,6,2,1,3
----
102
444
102
-2
103
1
106
333
107
-1
109
-2
113
222
112
-1
110
-1
119
222
117
-1
117
3
123
222
122
1
120
1
125
222
127
4
126
-3
134
333
132
-4
132
1
137
222
137
2
135
1
141
222
142
2
144
1
147
444
147
-2
146
-1
150
333
152
1
152
-4
155
333
157
3
157
-1
161
444
162
-1
162
-3
166
333
167
1
165
-3
172
444
172
-2
173
1
176
444
177
-1
177
-2
184
333
182
-3
180
1
187
333
187
-1
189
2
193
222
192
1
192
3
195
333
197
3
197
-1
202
333
202
-2
204
-1
208
222
207
-2
209
1
214
333
212
-3
210
2
215
222
217
3
219
-2
224
222
222
-1
221
2
225
333
227
3
227
-1
231
333
232
1
230
-2
235
444
237
1
237
-3
244
444
242
-4
242
3
247
111
247
2
246
-1

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c,
       b
  FROM t1
 WHERE (e>a AND e<b)
    OR d>e
    OR a>b
 ORDER BY 2,1,3
----
0
102
100
1
106
105
2
113
112
3
119
118
4
123
124
5
125
129
6
134
130
7
137
139
9
147
145
10
150
151
11
155
158
12
161
160
13
166
167
14
172
170
15
176
175
16
184
181
17
187
186
18
193
194
19
195
198
20
202
200
22
214
211
24
224
223
25
225
228
26
231
232
27
235
236
28
244
240
29
247
249

query IIIII nosort
SELECT a+b*2+c*3,
       c,
       abs(a),
       a+b*2+c*3+d*4+e*5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>a AND e<b)
    OR d>e
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,4,2,5,1
----
610
102
104
1529
1000
635
106
107
1612
1050
674
113
111
1680
1120
708
119
115
1757
1180
738
123
121
1826
1240
760
125
127
1902
1290
793
134
131
1985
1300
827
137
138
2046
1390
880
147
149
2202
1450
905
150
153
2281
1510
966
161
163
2432
1600
1000
166
168
2501
1670
1057
176
179
2654
358
1096
184
182
2728
364
1158
193
191
2878
382
1277
214
213
3175
426
1338
224
220
3331
440
1391
231
234
3473
468
1416
235
239
3553
478
1484
247
245
3706
490

query IIIIII nosort
SELECT a-b,
       c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c,
       e,
       c
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 3,5,1,4,6,2
----
-3
3
333
-1
117
119
-3
3
444
1
192
193
-3
2
444
-1
221
224
-4
-1
444
2
246
247

query IIIII nosort
SELECT c,
       a+b*2+c*3,
       c-d,
       abs(a),
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE d>e
    OR (c<=d-2 OR c>=d+2)
    OR (e>c OR e<d)
 ORDER BY 1,3,5,2,4
----
102
610
1
104
1529
106
635
-2
107
1612
113
674
-1
111
1680
119
708
3
115
1757
123
738
1
121
1826
125
760
-3
127
1902
134
793
1
131
1985
137
827
1
138
2046
141
851
1
142
2131
147
880
-1
149
2202
150
905
-4
153
2281
155
940
-1
159
2349
161
966
-3
163
2432
166
1000
-3
168
2501
172
1030
1
174
2579
176
1057
-2
179
2654
184
1096
1
182
2728
187
1121
2
188
2806
193
1158
3
191
2878
195
1180
-1
199
2949
202
1207
-1
201
3039
208
1241
1
205
3114
214
1277
2
213
3175
215
1297
-2
216
3260
224
1338
2
220
3331
225
1360
-1
229
3399
231
1391
-2
234
3473
235
1416
-3
239
3553
244
1455
3
243
3629
247
1484
-1
245
3706

query II nosort
SELECT c,
       a+b*2
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR c>d
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1,2
----
102
304
106
317
113
335
119
351
123
369
134
391
137
416
141
428
147
439
150
455
155
475
161
483
166
502
172
514
176
529
184
544
187
560
193
579
195
595
202
601
208
617
214
635
224
666
225
685
231
698
235
711
244
723
247
743

query II nosort
SELECT a+b*2+c*3+d*4,
       (a+b+c+d+e)/5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,1
----
1014
102
1067
107
1130
112
1172
117
1226
122
1272
127

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a),
       abs(b-c),
       b-c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR d>e
    OR (a>b-2 AND a<b+2)
 ORDER BY 3,4,2,1,5
----
0
333
107
1
-1
0
222
111
1
-1
0
222
115
1
-1
0
222
121
1
1
0
222
127
4
4
0
333
131
4
-4
0
222
138
2
2
0
222
142
2
2
0
444
149
2
-2
0
333
153
1
1
0
333
159
3
3
0
444
163
1
-1
0
333
168
1
1
0
444
179
1
-1
0
333
182
3
-3
0
333
188
1
-1
0
222
191
1
1
0
333
199
3
3
0
333
201
2
-2
0
222
205
2
-2
0
333
213
3
-3
0
222
216
3
3
0
222
220
1
-1
0
333
229
3
3
0
333
234
1
1
0
444
239
1
1
0
444
243
4
-4
0
111
245
2
2

query IIIII nosort
SELECT c-d,
       a+b*2+c*3+d*4,
       d,
       a-b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 2,1,5,3,4
----
1
1014
101
4
555
-2
1067
108
2
333
-1
1130
114
-1
111
3
1172
116
-3
333
1
1226
122
-3
333
-3
1272
128
-2
333
1
1325
133
1
444
1
1371
136
-1
111
1
1411
140
-1
111
-1
1472
148
4
555
-4
1521
154
2
333
-1
1564
156
1
555
-3
1622
164
3
333
-3
1676
169
1
333
1
1714
171
4
555
-2
1769
178
4
555
1
1828
183
1
333
2
1861
185
2
444
3
1918
190
-3
444
-1
1964
196
1
555
-1
2019
203
1
222
1
2069
207
-1
111
2
2125
212
2
222
-2
2165
217
-2
333
2
2226
222
-3
444
-1
2264
226
1
555
-2
2323
233
2
555
-3
2368
238
3
555
3
2419
241
3
222
-1
2476
248
-4
444

query IIIIII nosort
SELECT abs(b-c),
       a,
       a+b*2+c*3+d*4,
       c-d,
       c,
       (a+b+c+d+e)/5
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 6,3,1,4,5,2
----
2
104
1014
1
102
102
1
107
1067
-2
106
107
1
111
1130
-1
113
112
1
121
1226
1
123
122
4
127
1272
-3
125
127
4
131
1325
1
134
132
2
138
1371
1
137
137
2
142
1411
1
141
142
2
149
1472
-1
147
147
1
153
1521
-4
150
152
3
159
1564
-1
155
157
1
163
1622
-3
161
162
1
168
1676
-3
166
167
2
174
1714
1
172
172
1
179
1769
-2
176
177
3
182
1828
1
184
182
1
188
1861
2
187
187
3
199
1964
-1
195
197
2
201
2019
-1
202
202
2
205
2069
1
208
207
3
213
2125
2
214
212
3
216
2165
-2
215
217
1
220
2226
2
224
222
3
229
2264
-1
225
227
1
234
2323
-2
231
232
1
239
2368
-3
235
237
2
245
2476
-1
247
247

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 1
----
1529
1612
1680
1757
1826
1902
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2878
2949
3039
3114
3175
3260
3331
3399
3473
3553
3629
3706

query IIIII nosort
SELECT b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e,
       a+b*2,
       abs(b-c)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR c>d
    OR (a>b-2 AND a<b+2)
 ORDER BY 1,5,3,2,4
----
-4
1300
132
391
4
-4
486
242
723
4
-3
364
180
544
3
-3
426
210
635
3
-2
1000
103
304
2
-2
1700
173
514
2
-2
402
204
601
2
-2
410
209
617
2
-1
1050
109
317
1
-1
1120
110
335
1
-1
1180
117
351
1
-1
376
189
560
1
-1
440
221
666
1
1
1240
120
369
1
1
1670
165
502
1
1
382
192
579
1
2
1390
135
416
2
2
1430
144
428
2
3
1580
157
475
3
3
398
197
595
3
3
458
227
685
3
4
1290
126
385
4

query IIIIII nosort
SELECT abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b,
       b,
       a,
       b-c
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,2,4,6,1,5
----
115
222
-3
118
115
-1
121
222
-3
124
121
1
127
222
-2
129
127
4
111
222
-1
112
111
-1
107
333
2
105
107
-1
104
444
4
100
104
-2

query II nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR a>b
 ORDER BY 2,1
----
610
1529
635
1612
674
1680
708
1757
738
1826
760
1902
793
1985
827
2046
851
2131
880
2202
905
2281
940
2349
966
2432
1000
2501
1030
2579
1057
2654
1096
2728
1121
2806
1158
2878
1180
2949
1207
3039
1241
3114
1277
3175
1297
3260
1338
3331
1360
3399
1391
3473
1416
3553
1455
3629
1484
3706

query I nosort
SELECT a-b
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 1
----
-1
-1
-1
-1
1
1
1
1

query I nosort
SELECT abs(b-c)
  FROM t1
 ORDER BY 1
----
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4

query IIIIIII nosort
SELECT a+b*2+c*3,
       c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       (a+b+c+d+e)/5,
       a+b*2,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 3,2,5,7,1,6,4
----
674
-1
111
111
112
335
1120
827
1
111
138
137
416
1390
851
1
111
142
142
428
1430
1241
1
111
205
207
617
410
1207
-1
222
201
202
601
402
1277
2
222
213
212
635
426
1455
3
222
243
242
723
486
905
-4
333
153
152
455
1510
760
-3
333
127
127
385
1290
966
-3
333
163
162
483
1600
1000
-3
333
168
167
502
1670
635
-2
333
107
107
317
1050
1297
-2
333
216
217
652
432
738
1
333
121
122
369
1240
1096
1
333
182
182
544
364
708
3
333
115
117
351
1180
1484
-1
444
245
247
743
490
793
1
444
131
132
391
1300
1121
2
444
188
187
560
376
1338
2
444
220
222
666
440
1158
3
444
191
192
579
382
1416
-3
555
239
237
711
478
1057
-2
555
179
177
529
358
1391
-2
555
234
232
698
468
880
-1
555
149
147
439
1450
940
-1
555
159
157
475
1580
1180
-1
555
199
197
595
398
1360
-1
555
229
227
685
458
610
1
555
104
102
304
1000
1030
1
555
174
172
514
1700

query IIIIII nosort
SELECT d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b,
       c-d,
       (a+b+c+d+e)/5,
       b-c
  FROM t1
 ORDER BY 3,1,4,2,6,5
----
248
111
-4
-1
247
2
116
222
-3
3
117
-1
122
222
-3
1
122
1
190
222
-3
3
192
1
222
222
-3
2
222
-1
128
222
-2
-3
127
4
217
222
-2
-2
217
3
114
222
-1
-1
112
-1
136
222
-1
1
137
2
140
222
-1
1
142
2
207
222
-1
1
207
-2
133
333
1
1
132
-4
156
333
1
-1
157
3
169
333
1
-3
167
1
183
333
1
1
182
-3
196
333
1
-1
197
3
203
333
1
-1
202
-2
226
333
1
-1
227
3
108
333
2
-2
107
-1
154
333
2
-4
152
1
185
333
2
2
187
-1
212
333
2
2
212
-3
233
333
2
-2
232
1
164
444
3
-3
162
-1
238
444
3
-3
237
1
241
444
3
3
242
-4
101
444
4
1
102
-2
148
444
4
-1
147
-2
171
444
4
1
172
-2
178
444
4
-2
177
-1

query IIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4+e*5,
       abs(b-c),
       d
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 4,2,1,6,5,3
----
222
117
3
1757
1
116
222
192
18
2878
1
190
222
222
24
3331
1
222
111
247
29
3706
2
248

query III nosort
SELECT d,
       b,
       (a+b+c+d+e)/5
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1,3,2
----
101
100
102
108
105
107
114
112
112
122
124
122
128
129
127
133
130
132
136
139
137
140
143
142
148
145
147
154
151
152
156
158
157
164
160
162
169
167
167
171
170
172
178
175
177
183
181
182
185
186
187
196
198
197
203
200
202
207
206
207
212
211
212
217
218
217
222
223
222
226
228
227
233
232
232
238
236
237
248
249
247

query IIIII nosort
SELECT a+b*2+c*3+d*4,
       d-e,
       c-d,
       abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (e>a AND e<b)
 ORDER BY 3,1,5,2,4
----
2476
2
-1
245
490
2226
1
2
220
440
1172
-1
3
115
1180
1918
-2
3
191
382

query IIII nosort
SELECT abs(a),
       c-d,
       abs(b-c),
       a+b*2+c*3
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 3,2,4,1
----
168
-3
1
1000
111
-1
1
674
201
-1
2
1207
138
1
2
827
142
1
2
851
205
1
2
1241
159
-1
3
940
199
-1
3
1180
229
-1
3
1360
182
1
3
1096
131
1
4
793

query IIIIII nosort
SELECT c,
       e,
       b,
       abs(a),
       d,
       a
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 5,3,2,1,4,6
----
102
103
100
104
101
104
106
109
105
107
108
107
113
110
112
111
114
111
123
120
124
121
122
121
134
132
130
131
133
131
137
135
139
138
136
138
141
144
143
142
140
142
147
146
145
149
148
149
150
152
151
153
154
153
155
157
158
159
156
159
161
162
160
163
164
163
166
165
167
168
169
168
172
173
170
174
171
174
176
177
175
179
178
179
184
180
181
182
183
182
187
189
186
188
185
188
195
197
198
199
196
199
202
204
200
201
203
201
208
209
206
205
207
205
214
210
211
213
212
213
224
221
223
220
222
220
225
227
228
229
226
229
231
230
232
234
233
234
235
237
236
239
238
239
247
246
249
245
248
245

query II nosort
SELECT a-b,
       a+b*2
  FROM t1
 WHERE b>c
    OR c>d
 ORDER BY 2,1
----
4
304
-3
351
-3
369
-2
385
1
391
-1
416
-1
428
2
455
1
475
1
502
4
514
1
544
2
560
-3
579
1
595
-1
617
2
635
-2
652
-3
666
1
685
2
698
3
711
3
723
-4
743

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(b-c)
  FROM t1
 ORDER BY 2,1
----
1612
1
1680
1
1757
1
1826
1
2281
1
2432
1
2501
1
2654
1
2806
1
2878
1
3331
1
3473
1
3553
1
1529
2
2046
2
2131
2
2202
2
2579
2
3039
2
3114
2
3706
2
2349
3
2728
3
2949
3
3175
3
3260
3
3399
3
1902
4
1985
4
3629
4

query IIII nosort
SELECT d-e,
       a+b*2+c*3,
       a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE d>e
    OR (e>a AND e<b)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 3,4,1,2
----
2
1484
-4
490
-2
1158
-3
382
1
1338
-3
440
-1
708
-3
1180
2
738
-3
1240
-2
1297
-2
432
2
760
-2
1290
4
674
-1
1120
1
827
-1
1390
3
1096
1
364
1
793
1
1300
4
1000
1
1670
-4
1121
2
376
2
1277
2
426
3
1391
2
468
-1
635
2
1050
2
905
2
1510
1
1416
3
478
-1
1455
3
486
2
966
3
1600
1
1057
4
358
2
880
4
1450

query IIIIII nosort
SELECT d,
       d-e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       b,
       c,
       a+b*2+c*3
  FROM t1
 WHERE a>b
    OR b>c
 ORDER BY 3,1,5,6,4,2
----
248
2
111
249
247
1484
122
2
222
124
123
738
128
2
222
129
125
760
136
1
222
139
137
827
140
-4
222
143
141
851
190
-2
222
194
193
1158
217
-2
222
218
215
1297
108
-1
333
105
106
635
133
1
333
130
134
793
154
2
333
151
150
905
156
-1
333
158
155
940
169
4
333
167
166
1000
183
3
333
181
184
1096
185
-4
333
186
187
1121
196
-1
333
198
195
1180
203
-1
333
200
202
1207
212
2
333
211
214
1277
226
-1
333
228
225
1360
233
3
333
232
231
1391
101
-2
444
100
102
610
148
2
444
145
147
880
164
2
444
160
161
966
171
-2
444
170
172
1030
178
1
444
175
176
1057
238
1
444
236
235
1416
241
-1
444
240
244
1455

query III nosort
SELECT abs(b-c),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 1,3,2
----
1
222
111
1
222
333
1
222
333
1
333
333
1
333
333
1
333
333
1
444
333
1
222
444
1
222
444
1
333
444
1
333
555
1
444
555
1
444
555
2
222
111
2
222
111
2
222
111
2
333
222
2
111
444
2
444
555
2
444
555
2
444
555
3
333
222
3
222
333
3
333
333
3
333
555
3
333
555
3
333
555
4
444
222
4
222
333
4
333
444

query IIIII nosort
SELECT c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c-d,
       a,
       b
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR c>d
 ORDER BY 1,2,5,3,4
----
102
444
1
104
100
106
333
-2
107
105
119
222
3
115
118
123
222
1
121
124
125
222
-3
127
129
134
333
1
131
130
137
222
1
138
139
141
222
1
142
143
150
333
-4
153
151
161
444
-3
163
160
166
333
-3
168
167
172
444
1
174
170
176
444
-2
179
175
184
333
1
182
181
187
333
2
188
186
193
222
3
191
194
208
222
1
205
206
214
333
2
213
211
215
222
-2
216
218
224
222
2
220
223
231
333
-2
234
232
235
444
-3
239
236
244
444
3
243
240

query IIIII nosort
SELECT abs(b-c),
       c-d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND d>e
   AND c BETWEEN b-2 AND d+2
 ORDER BY 1,2,5,3,4
----
1
-1
1120
674
0
1
1
1240
738
0

query III nosort
SELECT b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5
  FROM t1
 WHERE d>e
    OR (a>b-2 AND a<b+2)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1,3
----
105
1
107
112
2
112
118
3
117
124
4
122
129
5
127
130
6
132
139
7
137
143
8
142
145
9
147
151
10
152
158
11
157
160
12
162
167
13
167
170
14
172
175
15
177
181
16
182
186
17
187
194
18
192
198
19
197
200
20
202
206
21
207
211
22
212
218
23
217
223
24
222
228
25
227
232
26
232
236
27
237
240
28
242
249
29
247

query IIIII nosort
SELECT a-b,
       b-c,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b
  FROM t1
 ORDER BY 3,1,2,5,4
----
4
-2
1529
1000
100
2
-1
1612
1050
105
-1
-1
1680
1120
112
-3
-1
1757
1180
118
-3
1
1826
1240
124
-2
4
1902
1290
129
1
-4
1985
1300
130
-1
2
2046
1390
139
-1
2
2131
1430
143
4
-2
2202
1450
145
2
1
2281
1510
151
1
3
2349
1580
158
3
-1
2432
1600
160
1
1
2501
1670
167
4
-2
2579
1700
170
4
-1
2654
358
175
1
-3
2728
364
181
2
-1
2806
376
186
-3
1
2878
382
194
1
3
2949
398
198
1
-2
3039
402
200
-1
-2
3114
410
206
2
-3
3175
426
211
-2
3
3260
432
218
-3
-1
3331
440
223
1
3
3399
458
228
2
1
3473
468
232
3
1
3553
478
236
3
-4
3629
486
240
-4
2
3706
490
249

query IIIIII nosort
SELECT a+b*2,
       a+b*2+c*3+d*4,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       b,
       c-d,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>c OR e<d)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,5,2,1,4,6
----
743
2476
111
249
-1
3706
385
1272
222
129
-3
1902
652
2165
222
218
-2
3260
335
1130
222
112
-1
1680
369
1226
222
124
1
1826
416
1371
222
139
1
2046
428
1411
222
143
1
2131
617
2069
222
206
1
3114
666
2226
222
223
2
3331
351
1172
222
118
3
1757
579
1918
222
194
3
2878
455
1521
333
151
-4
2281
502
1676
333
167
-3
2501
317
1067
333
105
-2
1612
698
2323
333
232
-2
3473
475
1564
333
158
-1
2349
595
1964
333
198
-1
2949
601
2019
333
200
-1
3039
685
2264
333
228
-1
3399
391
1325
333
130
1
1985
544
1828
333
181
1
2728
560
1861
333
186
2
2806
635
2125
333
211
2
3175
483
1622
444
160
-3
2432
711
2368
444
236
-3
3553
529
1769
444
175
-2
2654
439
1472
444
145
-1
2202
304
1014
444
100
1
1529
514
1714
444
170
1
2579
723
2419
444
240
3
3629

query IIIIIII nosort
SELECT e,
       a+b*2+c*3+d*4,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c,
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE a>b
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1,4,7,6,5,3,2
----
103
1014
104
0
102
-2
555
109
1067
107
1
106
-1
333
132
1325
131
6
134
-4
444
146
1472
149
9
147
-2
555
152
1521
153
10
150
1
333
157
1564
159
11
155
3
555
162
1622
163
12
161
-1
333
165
1676
168
13
166
1
333
173
1714
174
14
172
-2
555
177
1769
179
15
176
-1
555
180
1828
182
16
184
-3
333
189
1861
188
17
187
-1
444
192
1918
191
18
193
1
444
197
1964
199
19
195
3
555
204
2019
201
20
202
-2
222
209
2069
205
21
208
-2
111
210
2125
213
22
214
-3
222
219
2165
216
23
215
3
333
221
2226
220
24
224
-1
444
227
2264
229
25
225
3
555
230
2323
234
26
231
1
555
237
2368
239
27
235
1
555
242
2419
243
28
244
-4
222
246
2476
245
29
247
2
444

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c>d
   AND c BETWEEN b-2 AND d+2
   AND (e>c OR e<d)
 ORDER BY 6,2,5,4,1,3
----
1226
222
1240
1826
738
0
1371
222
1390
2046
827
0
1411
222
1430
2131
851
0
2069
222
410
3114
1241
0
2226
222
440
3331
1338
0
1325
333
1300
1985
793
0
1828
333
364
2728
1096
0
1861
333
376
2806
1121
0
2125
333
426
3175
1277
0
1014
444
1000
1529
610
0
1714
444
1700
2579
1030
0

query IIIIII nosort
SELECT a+b*2+c*3,
       abs(a),
       e,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d
  FROM t1
 WHERE (e>c OR e<d)
    OR c BETWEEN b-2 AND d+2
    OR a>b
 ORDER BY 5,2,4,1,3,6
----
1057
179
177
176
358
178
1096
182
180
184
364
183
1121
188
189
187
376
185
1180
199
197
195
398
196
1207
201
204
202
402
203
1241
205
209
208
410
207
1277
213
210
214
426
212
1297
216
219
215
432
217
1338
220
221
224
440
222
1360
229
227
225
458
226
1391
234
230
231
468
233
1416
239
237
235
478
238
1455
243
242
244
486
241
1484
245
246
247
490
248
610
104
103
102
1000
101
635
107
109
106
1050
108
674
111
110
113
1120
114
738
121
120
123
1240
122
760
127
126
125
1290
128
793
131
132
134
1300
133
827
138
135
137
1390
136
851
142
144
141
1430
140
880
149
146
147
1450
148
905
153
152
150
1510
154
940
159
157
155
1580
156
966
163
162
161
1600
164
1000
168
165
166
1670
169
1030
174
173
172
1700
171

query IIIII nosort
SELECT a+b*2,
       abs(a),
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c
  FROM t1
 WHERE b>c
 ORDER BY 5,1,3,2,4
----
369
121
122
4
1
455
153
154
10
1
502
168
169
13
1
579
191
190
18
1
698
234
233
26
1
711
239
238
27
1
416
138
136
7
2
428
142
140
8
2
743
245
248
29
2
475
159
156
11
3
595
199
196
19
3
652
216
217
23
3
685
229
226
25
3
385
127
128
5
4

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 3,1,6,4,2,5
----
0
0
610
444
2
555
1
0
635
333
1
333
2
0
674
222
1
111
4
0
738
222
1
333
6
0
793
333
4
444
7
0
827
222
2
111
8
0
851
222
2
111
9
0
880
444
2
555
10
0
905
333
1
333
12
0
966
444
1
333
13
0
1000
333
1
333
14
0
1030
444
2
555
15
0
1057
444
1
555
16
0
1096
333
3
333
17
0
1121
333
1
444
20
0
1207
333
2
222
21
0
1241
222
2
111
22
0
1277
333
3
222
24
0
1338
222
1
444
26
0
1391
333
1
555
27
0
1416
444
1
555
29
0
1484
111
2
444

query III nosort
SELECT b-c,
       a+b*2,
       b
  FROM t1
 ORDER BY 2,3,1
----
-2
304
100
-1
317
105
-1
335
112
-1
351
118
1
369
124
4
385
129
-4
391
130
2
416
139
2
428
143
-2
439
145
1
455
151
3
475
158
-1
483
160
1
502
167
-2
514
170
-1
529
175
-3
544
181
-1
560
186
1
579
194
3
595
198
-2
601
200
-2
617
206
-3
635
211
3
652
218
-1
666
223
3
685
228
1
698
232
1
711
236
-4
723
240
2
743
249

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d
  FROM t1
 WHERE a>b
   AND e+d BETWEEN a+b-10 AND c+130
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1,2
----
1
108

query I nosort
SELECT a
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1
----
104
107
111
121
127
131
138
142
149
153
159
163
168
174
179
182
188
199
201
205
213
216
220
229
234
239
245

query IIII nosort
SELECT abs(b-c),
       a+b*2+c*3+d*4,
       c-d,
       a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 4,1,3,2
----
2
1014
1
1529
1
1067
-2
1612
1
1130
-1
1680
1
1172
3
1757
1
1226
1
1826
4
1272
-3
1902
4
1325
1
1985
2
1371
1
2046
2
1411
1
2131
2
1472
-1
2202
1
1521
-4
2281
3
1564
-1
2349
1
1622
-3
2432
1
1676
-3
2501
2
1714
1
2579
1
1769
-2
2654
3
1828
1
2728
1
1861
2
2806
1
1918
3
2878
3
1964
-1
2949
2
2019
-1
3039
2
2069
1
3114
3
2125
2
3175
3
2165
-2
3260
1
2226
2
3331
3
2264
-1
3399
1
2323
-2
3473
1
2368
-3
3553
4
2419
3
3629
2
2476
-1
3706

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 1,2,3
----
0
2
555
1
1
333
2
1
111
3
1
333
4
1
333
5
4
333
6
4
444
7
2
111
8
2
111
9
2
555
10
1
333
11
3
555
12
1
333
13
1
333
14
2
555
15
1
555
16
3
333
17
1
444
18
1
444
19
3
555
20
2
222
21
2
111
22
3
222
23
3
333
24
1
444
25
3
555
26
1
555
27
1
555
28
4
222
29
2
444

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 1,2,3
----
0
-4
222
0
-4
444
0
-3
222
0
-3
333
0
-2
111
0
-2
222
0
-2
555
0
-2
555
0
-2
555
0
-1
111
0
-1
333
0
-1
333
0
-1
333
0
-1
444
0
-1
444
0
-1
555
0
1
333
0
1
333
0
1
333
0
1
444
0
1
555
0
1
555
0
2
111
0
2
111
0
2
444
0
3
333
0
3
555
0
3
555
0
3
555
0
4
333

query III nosort
SELECT d,
       a+b*2+c*3,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 2,1,3
----
101
610
555
108
635
333
114
674
111
116
708
333
122
738
333
128
760
333
133
793
444
136
827
111
140
851
111
148
880
555
154
905
333
156
940
555
164
966
333
169
1000
333
171
1030
555
178
1057
555
183
1096
333
185
1121
444
190
1158
444
196
1180
555
203
1207
222
207
1241
111
212
1277
222
217
1297
333
222
1338
444
226
1360
555
233
1391
555
238
1416
555
241
1455
222
248
1484
444

query III nosort
SELECT e,
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 1,2,3
----
103
2
0
109
1
1
110
1
2
117
1
3
120
1
4
126
4
5
132
4
6
135
2
7
144
2
8
146
2
9
152
1
10
157
3
11
162
1
12
165
1
13
173
2
14
177
1
15
180
3
16
189
1
17
192
1
18
197
3
19
204
2
20
209
2
21
210
3
22
219
3
23
221
1
24
227
3
25
230
1
26
237
1
27
242
4
28
246
2
29

query I nosort
SELECT c
  FROM t1
 ORDER BY 1
----
102
106
113
119
123
125
134
137
141
147
150
155
161
166
172
176
184
187
193
195
202
208
214
215
224
225
231
235
244
247

query I nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d>e
   AND (c<=d-2 OR c>=d+2)
   AND (e>a AND e<b)
 ORDER BY 1
----
444

query II nosort
SELECT c,
       a+b*2+c*3+d*4
  FROM t1
 WHERE b>c
   AND (a>b-2 AND a<b+2)
   AND (e>a AND e<b)
 ORDER BY 2,1
----

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(a)
  FROM t1
 WHERE c>d
   AND b>c
 ORDER BY 2,1
----
1240
121
1390
138
1430
142
382
191

query IIIIII nosort
SELECT e,
       a+b*2+c*3+d*4+e*5,
       d-e,
       b-c,
       a+b*2+c*3+d*4,
       abs(b-c)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 2,4,6,1,5,3
----
117
1757
-1
-1
1172
1
192
2878
-2
1
1918
1
221
3331
1
-1
2226
1
246
3706
2
2
2476
2

query I nosort
SELECT a
  FROM t1
 WHERE d>e
 ORDER BY 1
----
111
121
127
131
138
149
153
163
168
179
182
213
220
234
239
245

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 WHERE b>c
 ORDER BY 1
----
1226
1272
1371
1411
1521
1564
1676
1918
1964
2165
2264
2323
2368
2476

query IIIII nosort
SELECT d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4,
       abs(b-c),
       e
  FROM t1
 ORDER BY 3,4,5,1,2
----
-2
0
1014
2
103
-1
1
1067
1
109
4
2
1130
1
110
-1
3
1172
1
117
2
4
1226
1
120
2
5
1272
4
126
1
6
1325
4
132
1
7
1371
2
135
-4
8
1411
2
144
2
9
1472
2
146
2
10
1521
1
152
-1
11
1564
3
157
2
12
1622
1
162
4
13
1676
1
165
-2
14
1714
2
173
1
15
1769
1
177
3
16
1828
3
180
-4
17
1861
1
189
-2
18
1918
1
192
-1
19
1964
3
197
-1
20
2019
2
204
-2
21
2069
2
209
2
22
2125
3
210
-2
23
2165
3
219
1
24
2226
1
221
-1
25
2264
3
227
3
26
2323
1
230
1
27
2368
1
237
-1
28
2419
4
242
2
29
2476
2
246

query IIIIII nosort
SELECT e,
       b-c,
       abs(b-c),
       a+b*2+c*3+d*4+e*5,
       c-d,
       abs(a)
  FROM t1
 WHERE b>c
 ORDER BY 3,6,2,1,5,4
----
120
1
1
1826
1
121
152
1
1
2281
-4
153
165
1
1
2501
-3
168
192
1
1
2878
3
191
230
1
1
3473
-2
234
237
1
1
3553
-3
239
135
2
2
2046
1
138
144
2
2
2131
1
142
246
2
2
3706
-1
245
157
3
3
2349
-1
159
197
3
3
2949
-1
199
219
3
3
3260
-2
216
227
3
3
3399
-1
229
126
4
4
1902
-3
127

query I nosort
SELECT b-c
  FROM t1
 ORDER BY 1
----
-4
-4
-3
-3
-2
-2
-2
-2
-2
-1
-1
-1
-1
-1
-1
-1
1
1
1
1
1
1
2
2
2
3
3
3
3
4

query IIIIII nosort
SELECT abs(b-c),
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(a),
       c,
       a+b*2+c*3
  FROM t1
 WHERE a>b
 ORDER BY 3,4,6,1,2,5
----
2
102
0
104
102
610
1
107
1
107
106
635
4
132
6
131
134
793
2
147
9
149
147
880
1
152
10
153
150
905
3
157
11
159
155
940
1
162
12
163
161
966
1
167
13
168
166
1000
2
172
14
174
172
1030
1
177
15
179
176
1057
3
182
16
182
184
1096
1
187
17
188
187
1121
3
197
19
199
195
1180
2
202
20
201
202
1207
3
212
22
213
214
1277
3
227
25
229
225
1360
1
232
26
234
231
1391
1
237
27
239
235
1416
4
242
28
243
244
1455

query II nosort
SELECT d,
       abs(b-c)
  FROM t1
 WHERE (e>c OR e<d)
   AND b>c
 ORDER BY 2,1
----
122
1
154
1
169
1
233
1
238
1
136
2
140
2
248
2
156
3
196
3
217
3
226
3
128
4

query IIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       a+b*2+c*3+d*4,
       a+b*2+c*3
  FROM t1
 WHERE d>e
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1,4,3,2
----
111
248
2476
1484
222
114
1130
674
222
122
1226
738
222
128
1272
760
222
136
1371
827
222
140
1411
851
222
207
2069
1241
222
222
2226
1338
333
108
1067
635
333
133
1325
793
333
154
1521
905
333
169
1676
1000
333
183
1828
1096
333
185
1861
1121
333
203
2019
1207
333
212
2125
1277
333
233
2323
1391
444
101
1014
610
444
148
1472
880
444
164
1622
966
444
171
1714
1030
444
178
1769
1057
444
238
2368
1416

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       abs(a),
       b-c
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 1,3,2
----
1612
107
-1
1757
115
-1
1902
127
4
2281
153
1
2432
163
-1
2501
168
1
2654
179
-1
2806
188
-1
2878
191
1
3175
213
-3
3260
216
3
3331
220
-1
3473
234
1
3553
239
1
3629
243
-4

query I nosort
SELECT c
  FROM t1
 WHERE b>c
 ORDER BY 1
----
123
125
137
141
150
155
166
193
195
215
225
231
235
247

query IIIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       a+b*2,
       c,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND b>c
 ORDER BY 6,1,5,7,4,3,2
----
333
121
369
123
-3
4
222
333
127
385
125
-2
5
222
111
138
416
137
-1
7
222
111
142
428
141
-1
8
222
333
153
455
150
2
10
333
555
159
475
155
1
11
333
333
168
502
166
1
13
333
444
191
579
193
-3
18
222
555
199
595
195
1
19
333
333
216
652
215
-2
23
222
555
229
685
225
1
25
333
555
234
698
231
2
26
333
555
239
711
235
3
27
444
444
245
743
247
-4
29
111

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 3,4,7,5,2,6,1
----
15
4
358
178
555
2654
0
16
1
364
183
333
2728
0
17
2
376
185
444
2806
0
18
-3
382
190
444
2878
0
19
1
398
196
555
2949
0
20
1
402
203
222
3039
0
21
-1
410
207
111
3114
0
22
2
426
212
222
3175
0
23
-2
432
217
333
3260
0
24
-3
440
222
444
3331
0
25
1
458
226
555
3399
0
26
2
468
233
555
3473
0
27
3
478
238
555
3553
0
28
3
486
241
222
3629
0
29
-4
490
248
444
3706
0
0
4
1000
101
555
1529
0
1
2
1050
108
333
1612
0
2
-1
1120
114
111
1680
0
3
-3
1180
116
333
1757
0
4
-3
1240
122
333
1826
0
5
-2
1290
128
333
1902
0
6
1
1300
133
444
1985
0
7
-1
1390
136
111
2046
0
8
-1
1430
140
111
2131
0
9
4
1450
148
555
2202
0
10
2
1510
154
333
2281
0
11
1
1580
156
555
2349
0
12
3
1600
164
333
2432
0
13
1
1670
169
333
2501
0
14
4
1700
171
555
2579
0

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e,
       a+b*2+c*3,
       a-b,
       a+b*2+c*3+d*4+e*5,
       b-c
  FROM t1
 WHERE b>c
   AND a>b
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 5,1,3,6,2,4
----
0
2
905
2
2281
1
0
4
1000
1
2501
1
0
3
1391
2
3473
1
0
1
1416
3
3553
1

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       a-b,
       a+b*2,
       abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3
  FROM t1
 ORDER BY 1,5,4,2,6,3
----
1014
4
304
104
555
610
1067
2
317
107
333
635
1130
-1
335
111
111
674
1172
-3
351
115
333
708
1226
-3
369
121
333
738
1272
-2
385
127
333
760
1325
1
391
131
444
793
1371
-1
416
138
111
827
1411
-1
428
142
111
851
1472
4
439
149
555
880
1521
2
455
153
333
905
1564
1
475
159
555
940
1622
3
483
163
333
966
1676
1
502
168
333
1000
1714
4
514
174
555
1030
1769
4
529
179
555
1057
1828
1
544
182
333
1096
1861
2
560
188
444
1121
1918
-3
579
191
444
1158
1964
1
595
199
555
1180
2019
1
601
201
222
1207
2069
-1
617
205
111
1241
2125
2
635
213
222
1277
2165
-2
652
216
333
1297
2226
-3
666
220
444
1338
2264
1
685
229
555
1360
2323
2
698
234
555
1391
2368
3
711
239
555
1416
2419
3
723
243
222
1455
2476
-4
743
245
444
1484

query IIII nosort
SELECT a+b*2+c*3+d*4,
       abs(b-c),
       b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d>e
 ORDER BY 3,1,2,4
----
1325
4
-4
444
1828
3
-3
333
2125
3
-3
222
1472
2
-2
555
1130
1
-1
111
1622
1
-1
333
1769
1
-1
555
2226
1
-1
444
1226
1
1
333
1521
1
1
333
1676
1
1
333
2323
1
1
555
2368
1
1
555
1371
2
2
111
2476
2
2
444
1272
4
4
333

query II nosort
SELECT abs(b-c),
       b-c
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND (a>b-2 AND a<b+2)
 ORDER BY 1,2
----
1
-1

query IIIIIII nosort
SELECT a-b,
       c,
       a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e,
       b-c,
       d-e
  FROM t1
 ORDER BY 7,2,5,4,1,3,6
----
-1
141
428
222
144
2
-4
2
187
560
333
189
-1
-4
4
102
304
444
103
-2
-2
4
172
514
444
173
-2
-2
-3
193
579
222
192
1
-2
-1
208
617
222
209
-2
-2
-2
215
652
222
219
3
-2
2
106
317
333
109
-1
-1
-3
119
351
222
117
-1
-1
1
155
475
333
157
3
-1
1
195
595
333
197
3
-1
1
202
601
333
204
-2
-1
1
225
685
333
227
3
-1
3
244
723
444
242
-4
-1
1
134
391
333
132
-4
1
-1
137
416
222
135
2
1
4
176
529
444
177
-1
1
-3
224
666
222
221
-1
1
3
235
711
444
237
1
1
-3
123
369
222
120
1
2
-2
125
385
222
126
4
2
4
147
439
444
146
-2
2
2
150
455
333
152
1
2
3
161
483
444
162
-1
2
2
214
635
333
210
-3
2
-4
247
743
111
246
2
2
1
184
544
333
180
-3
3
2
231
698
333
230
1
3
-1
113
335
222
110
-1
4
1
166
502
333
165
1
4

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a),
       b-c,
       a-b,
       a,
       c-d
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,6,1,2,4,5
----
0
104
-2
4
104
1
0
107
-1
2
107
-2
0
111
-1
-1
111
-1
0
115
-1
-3
115
3
0
121
1
-3
121
1
0
127
4
-2
127
-3

query II nosort
SELECT abs(a),
       d
  FROM t1
 WHERE (e>a AND e<b)
   AND a>b
   AND c>d
 ORDER BY 2,1
----

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       c,
       e,
       a+b*2+c*3,
       abs(b-c),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND d>e
   AND (e>c OR e<d)
 ORDER BY 1,5,3,6,4,2
----
1680
113
110
674
1
1120
1985
134
132
793
4
1300
2046
137
135
827
2
1390
2501
166
165
1000
1
1670
2728
184
180
1096
3
364

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
1612
1680
1757
1826
1902
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2878
2949
3039
3114
3175
3260
3331
3399
3473
3553
3629
3706

query II nosort
SELECT e,
       abs(a)
  FROM t1
 ORDER BY 2,1
----
103
104
109
107
110
111
117
115
120
121
126
127
132
131
135
138
144
142
146
149
152
153
157
159
162
163
165
168
173
174
177
179
180
182
189
188
192
191
197
199
204
201
209
205
210
213
219
216
221
220
227
229
230
234
237
239
242
243
246
245

query II nosort
SELECT abs(a),
       b
  FROM t1
 WHERE b>c
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1
----
107
105
111
112
115
118
121
124
127
129
131
130
138
139
142
143
149
145
153
151
159
158
163
160
168
167
174
170
179
175
182
181
188
186
191
194
199
198
201
200
205
206
213
211
216
218
220
223
229
228
234
232
239
236
243
240
245
249

query IIII nosort
SELECT d-e,
       b,
       b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE d>e
    OR d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
 ORDER BY 3,4,2,1
----
1
130
-4
0
-1
240
-4
0
3
181
-3
0
2
211
-3
0
-2
100
-2
0
2
145
-2
0
-2
170
-2
0
-1
200
-2
0
-2
206
-2
0
-1
105
-1
0
4
112
-1
0
2
160
-1
0
1
175
-1
0
-4
186
-1
0
1
223
-1
0
2
124
1
0
2
151
1
0
4
167
1
0
-2
194
1
0
3
232
1
0
1
236
1
0
1
139
2
0
-4
143
2
0
2
249
2
0
-1
158
3
0
-1
198
3
0
-2
218
3
0
-1
228
3
0
2
129
4
0

query I nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE b>c
    OR c BETWEEN b-2 AND d+2
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1
----
111
222
222
222
222
222
222
222
222
222
333
333
333
333
333
333
333
333
333
333
333
333
444
444
444
444
444
444
444

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d,
       c-d,
       a
  FROM t1
 ORDER BY 3,4,2,5,1
----
0
555
101
1
104
0
333
108
-2
107
0
111
114
-1
111
0
333
116
3
115
0
333
122
1
121
0
333
128
-3
127
0
444
133
1
131
0
111
136
1
138
0
111
140
1
142
0
555
148
-1
149
0
333
154
-4
153
0
555
156
-1
159
0
333
164
-3
163
0
333
169
-3
168
0
555
171
1
174
0
555
178
-2
179
0
333
183
1
182
0
444
185
2
188
0
444
190
3
191
0
555
196
-1
199
0
222
203
-1
201
0
111
207
1
205
0
222
212
2
213
0
333
217
-2
216
0
444
222
2
220
0
555
226
-1
229
0
555
233
-2
234
0
555
238
-3
239
0
222
241
3
243
0
444
248
-1
245

query I nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 ORDER BY 1
----
111
111
111
111
222
222
222
333
333
333
333
333
333
333
333
333
444
444
444
444
444
555
555
555
555
555
555
555
555
555

query II nosort
SELECT c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND a>b
   AND (e>a AND e<b)
 ORDER BY 2,1
----

query IIII nosort
SELECT abs(a),
       abs(b-c),
       d,
       a+b*2+c*3+d*4
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,3,4,1
----
107
1
108
1067
111
1
114
1130
115
1
116
1172
121
1
122
1226
104
2
101
1014
127
4
128
1272

query IIIIII nosort
SELECT abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b,
       a+b*2+c*3+d*4
  FROM t1
 WHERE d>e
    OR b>c
    OR (a>b-2 AND a<b+2)
 ORDER BY 1,5,6,4,2,3
----
111
222
114
2
112
1130
121
222
122
4
124
1226
127
222
128
5
129
1272
131
333
133
6
130
1325
138
222
136
7
139
1371
142
222
140
8
143
1411
149
444
148
9
145
1472
153
333
154
10
151
1521
159
333
156
11
158
1564
163
444
164
12
160
1622
168
333
169
13
167
1676
179
444
178
15
175
1769
182
333
183
16
181
1828
191
222
190
18
194
1918
199
333
196
19
198
1964
201
333
203
20
200
2019
205
222
207
21
206
2069
213
333
212
22
211
2125
216
222
217
23
218
2165
220
222
222
24
223
2226
229
333
226
25
228
2264
234
333
233
26
232
2323
239
444
238
27
236
2368
245
111
248
29
249
2476

query III nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE b>c
    OR d NOT BETWEEN 110 AND 150
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,2,1
----
1057
2654
358
1096
2728
364
1121
2806
376
1158
2878
382
1180
2949
398
1207
3039
402
1241
3114
410
1277
3175
426
1297
3260
432
1338
3331
440
1360
3399
458
1391
3473
468
1416
3553
478
1455
3629
486
1484
3706
490
610
1529
1000
635
1612
1050
674
1680
1120
708
1757
1180
738
1826
1240
760
1902
1290
827
2046
1390
851
2131
1430
905
2281
1510
940
2349
1580
966
2432
1600
1000
2501
1670
1030
2579
1700

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       e,
       d-e,
       b,
       c,
       b-c
  FROM t1
 ORDER BY 3,5,6,2,4,1
----
111
144
-4
143
141
2
444
189
-4
186
187
-1
555
103
-2
100
102
-2
555
173
-2
170
172
-2
444
192
-2
194
193
1
111
209
-2
206
208
-2
333
219
-2
218
215
3
333
109
-1
105
106
-1
333
117
-1
118
119
-1
555
157
-1
158
155
3
555
197
-1
198
195
3
222
204
-1
200
202
-2
555
227
-1
228
225
3
222
242
-1
240
244
-4
444
132
1
130
134
-4
111
135
1
139
137
2
555
177
1
175
176
-1
444
221
1
223
224
-1
555
237
1
236
235
1
333
120
2
124
123
1
333
126
2
129
125
4
555
146
2
145
147
-2
333
152
2
151
150
1
333
162
2
160
161
-1
222
210
2
211
214
-3
444
246
2
249
247
2
333
180
3
181
184
-3
555
230
3
232
231
1
111
110
4
112
113
-1
333
165
4
167
166
1

query II nosort
SELECT a+b*2,
       b
  FROM t1
 ORDER BY 1,2
----
304
100
317
105
335
112
351
118
369
124
385
129
391
130
416
139
428
143
439
145
455
151
475
158
483
160
502
167
514
170
529
175
544
181
560
186
579
194
595
198
601
200
617
206
635
211
652
218
666
223
685
228
698
232
711
236
723
240
743
249

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 ORDER BY 1
----
1014
1067
1130
1172
1226
1272
1325
1371
1411
1472
1521
1564
1622
1676
1714
1769
1828
1861
1918
1964
2019
2069
2125
2165
2226
2264
2323
2368
2419
2476

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4+e*5,
       abs(b-c),
       d
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 4,3,2,1
----
1
1612
1
108
3
1757
1
116
5
1902
4
128
10
2281
1
154
12
2432
1
164
13
2501
1
169
15
2654
1
178
17
2806
1
185
18
2878
1
190
22
3175
3
212
23
3260
3
217
24
3331
1
222
26
3473
1
233
27
3553
1
238
28
3629
4
241

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e,
       a+b*2,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       c-d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 4,2,6,1,7,3,5
----
0
180
544
364
2728
1096
1
0
197
595
398
2949
1180
-1
0
204
601
402
3039
1207
-1
0
209
617
410
3114
1241
1
0
227
685
458
3399
1360
-1
0
110
335
1120
1680
674
-1
0
132
391
1300
1985
793
1
0
135
416
1390
2046
827
1
0
144
428
1430
2131
851
1
0
157
475
1580
2349
940
-1
0
165
502
1670
2501
1000
-3

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a),
       e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e
  FROM t1
 WHERE a>b
   AND (e>a AND e<b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 3,1,5,4,2
----

query III nosort
SELECT b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(b-c)
  FROM t1
 ORDER BY 2,1,3
----
249
111
2
112
222
1
118
222
1
124
222
1
129
222
4
139
222
2
143
222
2
194
222
1
206
222
2
218
222
3
223
222
1
105
333
1
130
333
4
151
333
1
158
333
3
167
333
1
181
333
3
186
333
1
198
333
3
200
333
2
211
333
3
228
333
3
232
333
1
100
444
2
145
444
2
160
444
1
170
444
2
175
444
1
236
444
1
240
444
4

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND d>e
 ORDER BY 1
----
152
162
167
177
182
212
222
232
237
247

query IIIII nosort
SELECT c,
       (a+b+c+d+e)/5,
       a-b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE b>c
   AND (a>b-2 AND a<b+2)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 1,3,4,2,5
----
155
157
1
555
11
166
167
1
333
13
195
197
1
555
19
225
227
1
555
25

query IIII nosort
SELECT a,
       a+b*2+c*3+d*4+e*5,
       a+b*2,
       abs(a)
  FROM t1
 WHERE (e>c OR e<d)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1,3,4
----
107
1612
317
107
111
1680
335
111
121
1826
369
121
127
1902
385
127
131
1985
391
131
138
2046
416
138
142
2131
428
142
149
2202
439
149
153
2281
455
153
159
2349
475
159
163
2432
483
163
168
2501
502
168
174
2579
514
174
179
2654
529
179
182
2728
544
182
188
2806
560
188
199
2949
595
199
201
3039
601
201
205
3114
617
205
213
3175
635
213
216
3260
652
216
220
3331
666
220
229
3399
685
229
234
3473
698
234
239
3553
711
239
245
3706
743
245

query III nosort
SELECT d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR b>c
    OR a>b
 ORDER BY 1,3,2
----
101
1000
4
108
1050
2
114
1120
-1
116
1180
-3
122
1240
-3
128
1290
-2
133
1300
1
136
1390
-1
140
1430
-1
148
1450
4
154
1510
2
156
1580
1
164
1600
3
169
1670
1
171
1700
4
178
358
4
183
364
1
185
376
2
190
382
-3
196
398
1
203
402
1
207
410
-1
212
426
2
217
432
-2
222
440
-3
226
458
1
233
468
2
238
478
3
241
486
3
248
490
-4

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       d-e,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (a+b+c+d+e)/5,
       abs(b-c)
  FROM t1
 ORDER BY 2,4,3,1,5,6
----
1411
-4
142
111
142
2
1861
-4
188
444
187
1
2069
-2
205
111
207
2
2165
-2
216
333
217
3
1918
-2
191
444
192
1
1014
-2
104
555
102
2
1714
-2
174
555
172
2
2019
-1
201
222
202
2
2419
-1
243
222
242
4
1067
-1
107
333
107
1
1172
-1
115
333
117
1
1564
-1
159
555
157
3
1964
-1
199
555
197
3
2264
-1
229
555
227
3
1371
1
138
111
137
2
1325
1
131
444
132
4
2226
1
220
444
222
1
1769
1
179
555
177
1
2368
1
239
555
237
1
2125
2
213
222
212
3
1226
2
121
333
122
1
1272
2
127
333
127
4
1521
2
153
333
152
1
1622
2
163
333
162
1
2476
2
245
444
247
2
1472
2
149
555
147
2
1828
3
182
333
182
3
2323
3
234
555
232
1
1130
4
111
111
112
1
1676
4
168
333
167
1

query IIII nosort
SELECT a+b*2+c*3+d*4,
       a+b*2,
       e,
       (a+b+c+d+e)/5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND (e>c OR e<d)
 ORDER BY 2,4,3,1
----
1014
304
103
102
1067
317
109
107
1130
335
110
112
1226
369
120
122
1272
385
126
127

query III nosort
SELECT b-c,
       a+b*2+c*3+d*4+e*5,
       d
  FROM t1
 WHERE a>b
   AND (a>b-2 AND a<b+2)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,2,1
----
-4
1985
133
3
2349
156
1
2501
169
-3
2728
183
3
2949
196
-2
3039
203
3
3399
226

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a),
       a+b*2+c*3+d*4,
       (a+b+c+d+e)/5,
       e,
       b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (a>b-2 AND a<b+2)
    OR b>c
 ORDER BY 2,1,3,7,5,4,6
----
0
104
1014
102
103
100
444
0
107
1067
107
109
105
333
0
111
1130
112
110
112
222
0
115
1172
117
117
118
222
0
121
1226
122
120
124
222
0
127
1272
127
126
129
222
0
131
1325
132
132
130
333
0
138
1371
137
135
139
222
0
142
1411
142
144
143
222
0
153
1521
152
152
151
333
0
159
1564
157
157
158
333
0
168
1676
167
165
167
333
0
182
1828
182
180
181
333
0
191
1918
192
192
194
222
0
199
1964
197
197
198
333
0
201
2019
202
204
200
333
0
205
2069
207
209
206
222
0
216
2165
217
219
218
222
0
229
2264
227
227
228
333
0
234
2323
232
230
232
333
0
239
2368
237
237
236
444
0
245
2476
247
246
249
111

query IIIII nosort
SELECT abs(a),
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE a>b
 ORDER BY 4,1,5,2,3
----
104
103
0
101
0
107
109
1
108
0
131
132
6
133
0
149
146
9
148
0
153
152
10
154
0
159
157
11
156
0
163
162
12
164
0
168
165
13
169
0
174
173
14
171
0
179
177
15
178
0
182
180
16
183
0
188
189
17
185
0
199
197
19
196
0
201
204
20
203
0
213
210
22
212
0
229
227
25
226
0
234
230
26
233
0
239
237
27
238
0
243
242
28
241
0

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       b,
       a+b*2+c*3+d*4+e*5,
       c,
       d-e
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR c>d
 ORDER BY 2,5,3,4,1
----
102
100
1529
102
-2
112
112
1680
113
4
117
118
1757
119
-1
122
124
1826
123
2
132
130
1985
134
1
137
139
2046
137
1
142
143
2131
141
-4
157
158
2349
155
-1
167
167
2501
166
4
172
170
2579
172
-2
182
181
2728
184
3
187
186
2806
187
-4
192
194
2878
193
-2
197
198
2949
195
-1
202
200
3039
202
-1
207
206
3114
208
-2
212
211
3175
214
2
222
223
3331
224
1
227
228
3399
225
-1
242
240
3629
244
-1

query II nosort
SELECT abs(b-c),
       c-d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,2
----
1
-4
1
-3
1
-3
1
-3
1
-2
1
-2
1
-2
1
2
1
2
1
3
2
-1
2
-1
2
1
2
1
2
1
3
-2
3
-1
3
-1
3
-1
3
1
3
2
4
3

query III nosort
SELECT c,
       a+b*2+c*3+d*4+e*5,
       abs(a)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND (e>a AND e<b)
 ORDER BY 1,3,2
----
119
1757
115

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e,
       b,
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 1,3,2,4
----
0
-2
100
1014
0
-1
105
1067
0
4
112
1130
0
-1
118
1172
0
2
124
1226
0
2
129
1272
0
1
130
1325
0
1
139
1371
0
-4
143
1411
0
2
145
1472
0
2
151
1521
0
-1
158
1564
0
2
160
1622
0
4
167
1676
0
-2
170
1714
0
1
175
1769
0
3
181
1828
0
-4
186
1861
0
-2
194
1918
0
-1
198
1964
0
-1
200
2019
0
-2
206
2069
0
2
211
2125
0
-2
218
2165
0
1
223
2226
0
-1
228
2264
0
3
232
2323
0
1
236
2368
0
-1
240
2419
0
2
249
2476

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 3,1,2
----
111
2
0
111
7
0
111
8
0
111
21
0
222
20
0
222
22
0
222
28
0
333
1
0
333
3
0
333
4
0
333
5
0
333
10
0
333
12
0
333
13
0
333
16
0
333
23
0
444
6
0
444
17
0
444
18
0
444
24
0
444
29
0
555
0
0
555
9
0
555
11
0
555
14
0
555
15
0
555
19
0
555
25
0
555
26
0
555
27
0

query III nosort
SELECT c-d,
       a,
       abs(b-c)
  FROM t1
 WHERE b>c
    OR d NOT BETWEEN 110 AND 150
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,1,2
----
-4
153
1
-3
163
1
-3
168
1
-3
239
1
-2
107
1
-2
179
1
-2
234
1
-1
111
1
1
121
1
2
188
1
2
220
1
3
115
1
3
191
1
-1
149
2
-1
201
2
-1
245
2
1
104
2
1
138
2
1
142
2
1
174
2
1
205
2
-2
216
3
-1
159
3
-1
199
3
-1
229
3
1
182
3
2
213
3
-3
127
4
1
131
4
3
243
4

query III nosort
SELECT a,
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4
  FROM t1
 WHERE c>d
   AND (c<=d-2 OR c>=d+2)
   AND (e>c OR e<d)
 ORDER BY 3,2,1
----
188
187
1861
213
212
2125
220
222
2226

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       c-d,
       a
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND (e>c OR e<d)
   AND c>d
 ORDER BY 3,4,2,1
----
444
4
1
131
111
2
1
138
111
2
1
142
333
3
1
182
111
2
1
205

query III nosort
SELECT (a+b+c+d+e)/5,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (e>a AND e<b)
    OR c>d
 ORDER BY 2,1,3
----
102
304
0
117
351
3
122
369
4
132
391
6
137
416
7
142
428
8
172
514
14
182
544
16
187
560
17
192
579
18
207
617
21
212
635
22
222
666
24
242
723
28
247
743
29

query II nosort
SELECT a+b*2,
       a
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
    OR (e>a AND e<b)
 ORDER BY 2,1
----
304
104
317
107
335
111
351
115
369
121
385
127
391
131
416
138
428
142
439
149
455
153
475
159
483
163
502
168
514
174
529
179
544
182
560
188
579
191
595
199
601
201
617
205
635
213
652
216
666
220
685
229
698
234
711
239
743
245

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d,
       abs(b-c)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (e>a AND e<b)
 ORDER BY 1,3,5,4,2
----
2878
191
0
190
1
3331
220
0
222
1
3706
245
0
248
2

query IIIII nosort
SELECT d-e,
       b,
       a+b*2+c*3+d*4,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c
  FROM t1
 WHERE (e>c OR e<d)
   AND b>c
 ORDER BY 2,3,1,4,5
----
2
124
1226
333
1
2
129
1272
333
4
1
139
1371
111
2
-4
143
1411
111
2
2
151
1521
333
1
-1
158
1564
555
3
4
167
1676
333
1
-1
198
1964
555
3
-2
218
2165
333
3
-1
228
2264
555
3
3
232
2323
555
1
1
236
2368
555
1
2
249
2476
444
2

query IIIII nosort
SELECT d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c),
       (a+b+c+d+e)/5,
       c-d
  FROM t1
 WHERE a>b
 ORDER BY 1,3,2,4,5
----
-4
376
1
187
2
-2
1000
2
102
1
-2
1700
2
172
1
-1
1050
1
107
-2
-1
402
2
202
-1
-1
398
3
197
-1
-1
458
3
227
-1
-1
1580
3
157
-1
-1
486
4
242
3
1
358
1
177
-2
1
478
1
237
-3
1
1300
4
132
1
2
1510
1
152
-4
2
1600
1
162
-3
2
1450
2
147
-1
2
426
3
212
2
3
468
1
232
-2
3
364
3
182
1
4
1670
1
167
-3

query IIIIIII nosort
SELECT b,
       a,
       abs(b-c),
       a+b*2+c*3+d*4+e*5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(a),
       a+b*2
  FROM t1
 ORDER BY 4,1,2,7,5,3,6
----
100
104
2
1529
555
104
304
105
107
1
1612
333
107
317
112
111
1
1680
111
111
335
118
115
1
1757
333
115
351
124
121
1
1826
333
121
369
129
127
4
1902
333
127
385
130
131
4
1985
444
131
391
139
138
2
2046
111
138
416
143
142
2
2131
111
142
428
145
149
2
2202
555
149
439
151
153
1
2281
333
153
455
158
159
3
2349
555
159
475
160
163
1
2432
333
163
483
167
168
1
2501
333
168
502
170
174
2
2579
555
174
514
175
179
1
2654
555
179
529
181
182
3
2728
333
182
544
186
188
1
2806
444
188
560
194
191
1
2878
444
191
579
198
199
3
2949
555
199
595
200
201
2
3039
222
201
601
206
205
2
3114
111
205
617
211
213
3
3175
222
213
635
218
216
3
3260
333
216
652
223
220
1
3331
444
220
666
228
229
3
3399
555
229
685
232
234
1
3473
555
234
698
236
239
1
3553
555
239
711
240
243
4
3629
222
243
723
249
245
2
3706
444
245
743

query II nosort
SELECT e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 2,1
----
177
358
180
364
189
376
192
382
197
398
204
402
209
410
210
426
219
432
221
440
227
458
230
468
237
478
242
486
246
490
103
1000
109
1050
110
1120
117
1180
120
1240
126
1290
132
1300
135
1390
144
1430
146
1450
152
1510
157
1580
162
1600
165
1670
173
1700

query IIIII nosort
SELECT b,
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>c OR e<d)
    OR c>d
    OR (e>a AND e<b)
 ORDER BY 4,1,5,2,3
----
100
1
444
610
1000
105
-2
333
635
1050
112
-1
222
674
1120
118
3
222
708
1180
124
1
222
738
1240
129
-3
222
760
1290
130
1
333
793
1300
139
1
222
827
1390
143
1
222
851
1430
145
-1
444
880
1450
151
-4
333
905
1510
158
-1
333
940
1580
160
-3
444
966
1600
167
-3
333
1000
1670
170
1
444
1030
1700
175
-2
444
1057
358
181
1
333
1096
364
186
2
333
1121
376
194
3
222
1158
382
198
-1
333
1180
398
200
-1
333
1207
402
206
1
222
1241
410
211
2
333
1277
426
218
-2
222
1297
432
223
2
222
1338
440
228
-1
333
1360
458
232
-2
333
1391
468
236
-3
444
1416
478
240
3
444
1455
486
249
-1
111
1484
490

query IIII nosort
SELECT a+b*2,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3,
       a+b*2+c*3+d*4
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 2,4,3,1
----
529
358
1057
1769
560
376
1121
1861
579
382
1158
1918
635
426
1277
2125
652
432
1297
2165
666
440
1338
2226
698
468
1391
2323
711
478
1416
2368
723
486
1455
2419
317
1050
635
1067
351
1180
708
1172
385
1290
760
1272
455
1510
905
1521
483
1600
966
1622
502
1670
1000
1676

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c>d
 ORDER BY 2,1,3
----
486
-4
444
1300
-4
333
364
-3
333
426
-3
333
410
-2
222
1000
-2
444
1700
-2
444
376
-1
333
440
-1
222
1180
-1
222
382
1
222
1240
1
222
1390
2
222
1430
2
222

query IIIII nosort
SELECT a+b*2+c*3,
       d,
       a,
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,3,5,1,4
----
610
101
104
1014
0
635
108
107
1067
0
674
114
111
1130
0
708
116
115
1172
0
738
122
121
1226
0
760
128
127
1272
0

query IIII nosort
SELECT c-d,
       abs(b-c),
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE a>b
   AND e+d BETWEEN a+b-10 AND c+130
   AND (e>a AND e<b)
 ORDER BY 3,4,1,2
----

query IIII nosort
SELECT c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4,
       c-d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR (e>c OR e<d)
    OR (e>a AND e<b)
 ORDER BY 3,1,2,4
----
102
1000
1014
1
106
1050
1067
-2
113
1120
1130
-1
119
1180
1172
3
123
1240
1226
1
125
1290
1272
-3
134
1300
1325
1
137
1390
1371
1
141
1430
1411
1
147
1450
1472
-1
150
1510
1521
-4
155
1580
1564
-1
161
1600
1622
-3
166
1670
1676
-3
172
1700
1714
1
176
358
1769
-2
184
364
1828
1
187
376
1861
2
193
382
1918
3
195
398
1964
-1
202
402
2019
-1
208
410
2069
1
214
426
2125
2
215
432
2165
-2
224
440
2226
2
225
458
2264
-1
231
468
2323
-2
235
478
2368
-3
244
486
2419
3
247
490
2476
-1

query I nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1
----
111
111
111
111
222
222
333
333
333
333
333
333
333
333
444
444
444
444
555
555
555
555
555
555
555
555
555

query IIIII nosort
SELECT b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b-c,
       c,
       abs(b-c)
  FROM t1
 WHERE c>d
   AND (e>c OR e<d)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,3,2,5,4
----
124
0
1
123
1
130
0
-4
134
4
139
0
2
137
2
143
0
2
141
2
170
0
-2
172
2
181
0
-3
184
3
186
0
-1
187
1
206
0
-2
208
2
211
0
-3
214
3
223
0
-1
224
1

query IIIII nosort
SELECT d-e,
       c-d,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3+d*4,
       a
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 1,2,5,3,4
----
-4
2
2806
1861
188
-2
-2
3260
2165
216
-2
3
2878
1918
191
-1
-2
1612
1067
107
-1
3
1757
1172
115
-1
3
3629
2419
243
1
-3
3553
2368
239
1
-2
2654
1769
179
1
2
3331
2226
220
2
-4
2281
1521
153
2
-3
1902
1272
127
2
-3
2432
1622
163
2
2
3175
2125
213
3
-2
3473
2323
234
4
-3
2501
1676
168

query IIIIIII nosort
SELECT abs(b-c),
       a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d
  FROM t1
 ORDER BY 6,2,1,3,4,7,5
----
2
304
444
1000
0
0
1
1
317
333
1050
1
0
-2
1
335
222
1120
2
0
-1
1
351
222
1180
3
0
3
1
369
222
1240
4
0
1
4
385
222
1290
5
0
-3
4
391
333
1300
6
0
1
2
416
222
1390
7
0
1
2
428
222
1430
8
0
1
2
439
444
1450
9
0
-1
1
455
333
1510
10
0
-4
3
475
333
1580
11
0
-1
1
483
444
1600
12
0
-3
1
502
333
1670
13
0
-3
2
514
444
1700
14
0
1
1
529
444
358
15
0
-2
3
544
333
364
16
0
1
1
560
333
376
17
0
2
1
579
222
382
18
0
3
3
595
333
398
19
0
-1
2
601
333
402
20
0
-1
2
617
222
410
21
0
1
3
635
333
426
22
0
2
3
652
222
432
23
0
-2
1
666
222
440
24
0
2
3
685
333
458
25
0
-1
1
698
333
468
26
0
-2
1
711
444
478
27
0
-3
4
723
444
486
28
0
3
2
743
111
490
29
0
-1

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       a+b*2+c*3+d*4+e*5,
       d
  FROM t1
 WHERE a>b
   AND c BETWEEN b-2 AND d+2
 ORDER BY 5,6,3,7,2,4,1
----
152
1521
10
0
-4
2281
154
162
1622
12
0
-3
2432
164
167
1676
13
0
-3
2501
169
237
2368
27
0
-3
3553
238
107
1067
1
0
-2
1612
108
177
1769
15
0
-2
2654
178
232
2323
26
0
-2
3473
233
147
1472
9
0
-1
2202
148
202
2019
20
0
-1
3039
203
102
1014
0
0
1
1529
101
132
1325
6
0
1
1985
133
172
1714
14
0
1
2579
171
182
1828
16
0
1
2728
183
187
1861
17
0
2
2806
185
212
2125
22
0
2
3175
212

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       e,
       abs(a)
  FROM t1
 ORDER BY 3,1,2
----
555
103
104
333
109
107
111
110
111
333
117
115
333
120
121
333
126
127
444
132
131
111
135
138
111
144
142
555
146
149
333
152
153
555
157
159
333
162
163
333
165
168
555
173
174
555
177
179
333
180
182
444
189
188
444
192
191
555
197
199
222
204
201
111
209
205
222
210
213
333
219
216
444
221
220
555
227
229
555
230
234
555
237
239
222
242
243
444
246
245

query I nosort
SELECT e
  FROM t1
 WHERE c>d
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1
----
103
109
117
120
132
135
144
152
157
162
165
173
177
180
189
192
197
204
209
210
219
221
227
230
237
242
246

query IIIIIII nosort
SELECT a+b*2+c*3,
       b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(a),
       a+b*2,
       a
  FROM t1
 WHERE d>e
    OR c>d
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 6,2,1,7,5,4,3
----
610
100
0
555
104
304
104
635
105
0
333
107
317
107
674
112
0
111
111
335
111
708
118
0
333
115
351
115
738
124
0
333
121
369
121
760
129
0
333
127
385
127
793
130
0
444
131
391
131
827
139
0
111
138
416
138
851
143
0
111
142
428
142
880
145
0
555
149
439
149
905
151
0
333
153
455
153
966
160
0
333
163
483
163
1000
167
0
333
168
502
168
1030
170
0
555
174
514
174
1057
175
0
555
179
529
179
1096
181
0
333
182
544
182
1121
186
0
444
188
560
188
1158
194
0
444
191
579
191
1241
206
0
111
205
617
205
1277
211
0
222
213
635
213
1338
223
0
444
220
666
220
1391
232
0
555
234
698
234
1416
236
0
555
239
711
239
1455
240
0
222
243
723
243
1484
249
0
444
245
743
245

query III nosort
SELECT b-c,
       (a+b+c+d+e)/5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE b>c
 ORDER BY 1,2,3
----
1
122
1240
1
152
1510
1
167
1670
1
192
382
1
232
468
1
237
478
2
137
1390
2
142
1430
2
247
490
3
157
1580
3
197
398
3
217
432
3
227
458
4
127
1290

query IIIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       d-e,
       b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (e>a AND e<b)
   AND d>e
 ORDER BY 3,4,1,5,7,6,2
----
3331
1
223
440
-3
444
2226
3706
2
249
490
-4
444
2476

query IIIIIII nosort
SELECT e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c,
       abs(a),
       d,
       d-e
  FROM t1
 WHERE b>c
   AND d>e
 ORDER BY 1,6,2,4,3,7,5
----
120
4
222
123
121
122
2
126
5
222
125
127
128
2
135
7
222
137
138
136
1
152
10
333
150
153
154
2
165
13
333
166
168
169
4
230
26
333
231
234
233
3
237
27
444
235
239
238
1
246
29
111
247
245
248
2

query IIIII nosort
SELECT b-c,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (c<=d-2 OR c>=d+2)
   AND (e>c OR e<d)
 ORDER BY 3,4,2,1,5
----
-1
176
358
529
15
-1
187
376
560
17
-3
214
426
635
22
3
215
432
652
23
-1
224
440
666
24
1
231
468
698
26
1
235
478
711
27
-1
106
1050
317
1
4
125
1290
385
5
1
150
1510
455
10
-1
161
1600
483
12
1
166
1670
502
13

query IIIIII nosort
SELECT a+b*2,
       abs(b-c),
       a+b*2+c*3,
       c,
       e,
       d
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR b>c
 ORDER BY 6,3,5,2,1,4
----
317
1
635
106
109
108
335
1
674
113
110
114
351
1
708
119
117
116
369
1
738
123
120
122
385
4
760
125
126
128
391
4
793
134
132
133
416
2
827
137
135
136
428
2
851
141
144
140
439
2
880
147
146
148
455
1
905
150
152
154
475
3
940
155
157
156
483
1
966
161
162
164
502
1
1000
166
165
169
514
2
1030
172
173
171
529
1
1057
176
177
178
544
3
1096
184
180
183
560
1
1121
187
189
185
579
1
1158
193
192
190
595
3
1180
195
197
196
601
2
1207
202
204
203
617
2
1241
208
209
207
635
3
1277
214
210
212
652
3
1297
215
219
217
666
1
1338
224
221
222
685
3
1360
225
227
226
698
1
1391
231
230
233
711
1
1416
235
237
238
723
4
1455
244
242
241
743
2
1484
247
246
248

query II nosort
SELECT c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (a>b-2 AND a<b+2)
    OR c>d
 ORDER BY 2,1
----
176
358
184
364
187
376
193
382
195
398
202
402
208
410
214
426
215
432
224
440
225
458
231
468
235
478
244
486
247
490
102
1000
106
1050
113
1120
119
1180
123
1240
125
1290
134
1300
137
1390
141
1430
147
1450
150
1510
155
1580
161
1600
166
1670
172
1700

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE a>b
 ORDER BY 1
----
1529
1612
1985
2202
2281
2349
2432
2501
2579
2654
2728
2806
2949
3039
3175
3399
3473
3553
3629

query IIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2+c*3+d*4,
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR a>b
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1,4,2,3
----
102
1014
-2
555
107
1067
-1
333
112
1130
4
111
122
1226
2
333
132
1325
1
444
137
1371
1
111
142
1411
-4
111
147
1472
2
555
152
1521
2
333
157
1564
-1
555
162
1622
2
333
167
1676
4
333
172
1714
-2
555
177
1769
1
555
182
1828
3
333
187
1861
-4
444
192
1918
-2
444
197
1964
-1
555
202
2019
-1
222
207
2069
-2
111
212
2125
2
222
217
2165
-2
333
222
2226
1
444
227
2264
-1
555
232
2323
3
555
237
2368
1
555
242
2419
-1
222
247
2476
2
444

query I nosort
SELECT b-c
  FROM t1
 WHERE d>e
 ORDER BY 1
----
-4
-3
-3
-2
-1
-1
-1
-1
1
1
1
1
1
2
2
4

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1,2
----
0
102
1
106
2
113
4
123
5
125
6
134
7
137
8
141
9
147
10
150
11
155
12
161
13
166
14
172
15
176
16
184
17
187
19
195
20
202
21
208
22
214
23
215
24
224
25
225
26
231
27
235
29
247

query I nosort
SELECT b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR b>c
 ORDER BY 1
----
100
105
112
124
129
130
139
143
145
151
158
160
167
170
175
181
186
194
198
200
206
211
218
223
228
232
236
249

query IIIIIII nosort
SELECT e,
       b,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4
  FROM t1
 WHERE d>e
    OR d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
 ORDER BY 2,5,3,1,7,6,4
----
103
100
1529
444
2
555
1014
109
105
1612
333
1
333
1067
110
112
1680
222
1
111
1130
120
124
1826
222
1
333
1226
126
129
1902
222
4
333
1272
132
130
1985
333
4
444
1325
135
139
2046
222
2
111
1371
144
143
2131
222
2
111
1411
146
145
2202
444
2
555
1472
152
151
2281
333
1
333
1521
157
158
2349
333
3
555
1564
162
160
2432
444
1
333
1622
165
167
2501
333
1
333
1676
173
170
2579
444
2
555
1714
177
175
2654
444
1
555
1769
180
181
2728
333
3
333
1828
189
186
2806
333
1
444
1861
192
194
2878
222
1
444
1918
197
198
2949
333
3
555
1964
204
200
3039
333
2
222
2019
209
206
3114
222
2
111
2069
210
211
3175
333
3
222
2125
219
218
3260
222
3
333
2165
221
223
3331
222
1
444
2226
227
228
3399
333
3
555
2264
230
232
3473
333
1
555
2323
237
236
3553
444
1
555
2368
242
240
3629
444
4
222
2419
246
249
3706
111
2
444
2476

query III nosort
SELECT a+b*2+c*3,
       d-e,
       a-b
  FROM t1
 WHERE (e>a AND e<b)
    OR d>e
    OR (e>c OR e<d)
 ORDER BY 2,3,1
----
851
-4
-1
1121
-4
2
1158
-2
-3
1297
-2
-2
1241
-2
-1
610
-2
4
1030
-2
4
708
-1
-3
940
-1
1
1180
-1
1
1207
-1
1
1360
-1
1
635
-1
2
1338
1
-3
827
1
-1
793
1
1
1416
1
3
1057
1
4
1484
2
-4
738
2
-3
760
2
-2
905
2
2
1277
2
2
966
2
3
880
2
4
1096
3
1
1391
3
2
674
4
-1
1000
4
1

query IIIII nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       d-e,
       (a+b+c+d+e)/5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 2,5,4,3,1
----
610
1529
-2
102
1000
635
1612
-1
107
1050
674
1680
4
112
1120
708
1757
-1
117
1180
738
1826
2
122
1240
760
1902
2
127
1290
793
1985
1
132
1300
827
2046
1
137
1390
851
2131
-4
142
1430
880
2202
2
147
1450
905
2281
2
152
1510
940
2349
-1
157
1580
966
2432
2
162
1600
1000
2501
4
167
1670
1030
2579
-2
172
1700
1057
2654
1
177
358
1096
2728
3
182
364
1121
2806
-4
187
376
1158
2878
-2
192
382
1180
2949
-1
197
398
1207
3039
-1
202
402
1241
3114
-2
207
410
1277
3175
2
212
426
1297
3260
-2
217
432
1338
3331
1
222
440
1360
3399
-1
227
458
1391
3473
3
232
468
1416
3553
1
237
478
1455
3629
-1
242
486
1484
3706
2
247
490

query III nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2
  FROM t1
 ORDER BY 1,2,3
----
104
0
304
107
0
317
111
0
335
115
0
351
121
0
369
127
0
385
131
0
391
138
0
416
142
0
428
149
0
439
153
0
455
159
0
475
163
0
483
168
0
502
174
0
514
179
0
529
182
0
544
188
0
560
191
0
579
199
0
595
201
0
601
205
0
617
213
0
635
216
0
652
220
0
666
229
0
685
234
0
698
239
0
711
243
0
723
245
0
743

query IIII nosort
SELECT a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2
  FROM t1
 WHERE b>c
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,3,1,4
----
1067
1
333
317
1130
2
111
335
1172
3
333
351
1226
4
333
369
1272
5
333
385
1325
6
444
391
1371
7
111
416
1411
8
111
428
1472
9
555
439
1521
10
333
455
1564
11
555
475
1622
12
333
483
1676
13
333
502
1714
14
555
514
1769
15
555
529
1828
16
333
544
1861
17
444
560
1918
18
444
579
1964
19
555
595
2019
20
222
601
2069
21
111
617
2125
22
222
635
2165
23
333
652
2226
24
444
666
2264
25
555
685
2323
26
555
698
2368
27
555
711
2419
28
222
723
2476
29
444
743

query IIII nosort
SELECT abs(a),
       a-b,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 4,2,1,3
----
245
-4
3706
0
115
-3
1757
0
121
-3
1826
0
191
-3
2878
0
220
-3
3331
0
127
-2
1902
0
216
-2
3260
0
111
-1
1680
0
138
-1
2046
0
142
-1
2131
0
205
-1
3114
0
131
1
1985
0
159
1
2349
0
168
1
2501
0
182
1
2728
0
199
1
2949
0
201
1
3039
0
229
1
3399
0
107
2
1612
0
153
2
2281
0
188
2
2806
0
213
2
3175
0
234
2
3473
0
163
3
2432
0
239
3
3553
0
243
3
3629
0
104
4
1529
0
149
4
2202
0
174
4
2579
0
179
4
2654
0

query IIII nosort
SELECT c-d,
       b,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE a>b
 ORDER BY 4,3,2,1
----
1
100
103
0
-2
105
109
1
1
130
132
6
-1
145
146
9
-4
151
152
10
-1
158
157
11
-3
160
162
12
-3
167
165
13
1
170
173
14
-2
175
177
15
1
181
180
16
2
186
189
17
-1
198
197
19
-1
200
204
20
2
211
210
22
-1
228
227
25
-2
232
230
26
-3
236
237
27
3
240
242
28

query III nosort
SELECT d,
       c,
       a
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND d>e
   AND a>b
 ORDER BY 3,2,1
----
133
134
131
148
147
149
154
150
153
164
161
163
169
166
168
178
176
179
183
184
182
212
214
213
233
231
234
238
235
239

query I nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE b>c
 ORDER BY 1
----
382
398
432
458
468
478
490
1240
1290
1390
1430
1510
1580
1670

query IIII nosort
SELECT c-d,
       b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 4,3,1,2
----
1
-2
444
0
-2
-1
333
1
-1
-1
222
2
3
-1
222
3
1
1
222
4
-3
4
222
5
1
-4
333
6
1
2
222
7
1
2
222
8
-1
-2
444
9
-4
1
333
10
-1
3
333
11
-3
-1
444
12
-3
1
333
13
1
-2
444
14
-2
-1
444
15
1
-3
333
16
2
-1
333
17
3
1
222
18
-1
3
333
19
-1
-2
333
20
1
-2
222
21
2
-3
333
22
-2
3
222
23
2
-1
222
24
-1
3
333
25
-2
1
333
26
-3
1
444
27
3
-4
444
28
-1
2
111
29

query IIII nosort
SELECT a+b*2,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3,
       a-b
  FROM t1
 WHERE a>b
   AND (a>b-2 AND a<b+2)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 3,4,1,2
----
391
444
793
1
502
333
1000
1
544
333
1096
1
601
222
1207
1

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (e>a AND e<b)
 ORDER BY 6,3,1,5,4,2
----
0
304
0
1000
101
100
1
317
0
1050
108
105
2
335
0
1120
114
112
3
351
0
1180
116
118
4
369
0
1240
122
124
6
391
0
1300
133
130
7
416
0
1390
136
139
8
428
0
1430
140
143
9
439
0
1450
148
145
10
455
0
1510
154
151
12
483
0
1600
164
160
13
502
0
1670
169
167
14
514
0
1700
171
170
15
529
0
358
178
175
16
544
0
364
183
181
17
560
0
376
185
186
18
579
0
382
190
194
20
601
0
402
203
200
21
617
0
410
207
206
22
635
0
426
212
211
24
666
0
440
222
223
26
698
0
468
233
232
27
711
0
478
238
236
29
743
0
490
248
249

query I nosort
SELECT a-b
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1
----
-4
-3
-3
-2
-2
-1
-1
-1
-1
1
1
1
1
1
1
1
2
2
2
2
2
3
3
4
4
4
4

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE c>d
    OR c BETWEEN b-2 AND d+2
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,3,1
----
555
0
0
333
0
1
111
0
2
333
0
3
333
0
4
333
0
5
444
0
6
111
0
7
111
0
8
555
0
9
333
0
10
555
0
11
333
0
12
333
0
13
555
0
14
555
0
15
333
0
16
444
0
17
444
0
18
555
0
19
222
0
20
111
0
21
222
0
22
333
0
23
444
0
24
555
0
25
555
0
26
555
0
27
222
0
28
444
0
29

query IIIIII nosort
SELECT d,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       a+b*2,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>a AND e<b)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 5,1,3,6,4,2
----
222
224
24
-3
666
440
248
247
29
-4
743
490

query II nosort
SELECT abs(a),
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR b>c
 ORDER BY 2,1
----
104
1529
107
1612
111
1680
115
1757
121
1826
127
1902
138
2046
142
2131
153
2281
159
2349
168
2501
191
2878
199
2949
216
3260
229
3399
234
3473
239
3553
245
3706

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>c OR e<d)
   AND e+d BETWEEN a+b-10 AND c+130
   AND d>e
 ORDER BY 1
----
0
0
0

query IIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR c>d
 ORDER BY 1,3,2,4
----
1529
0
610
555
1612
1
635
333
1757
3
708
333
1826
4
738
333
1985
6
793
444
2046
7
827
111
2131
8
851
111
2281
10
905
333
2349
11
940
555
2432
12
966
333
2501
13
1000
333
2579
14
1030
555
2654
15
1057
555
2728
16
1096
333
2806
17
1121
444
2878
18
1158
444
2949
19
1180
555
3039
20
1207
222
3114
21
1241
111
3175
22
1277
222
3260
23
1297
333
3331
24
1338
444
3399
25
1360
555
3473
26
1391
555
3553
27
1416
555
3629
28
1455
222
3706
29
1484
444

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2,
       d
  FROM t1
 ORDER BY 3,1,2,5,4,6
----
555
2
102
1000
304
101
333
1
106
1050
317
108
111
1
113
1120
335
114
333
1
119
1180
351
116
333
1
123
1240
369
122
333
4
125
1290
385
128
444
4
134
1300
391
133
111
2
137
1390
416
136
111
2
141
1430
428
140
555
2
147
1450
439
148
333
1
150
1510
455
154
555
3
155
1580
475
156
333
1
161
1600
483
164
333
1
166
1670
502
169
555
2
172
1700
514
171
555
1
176
358
529
178
333
3
184
364
544
183
444
1
187
376
560
185
444
1
193
382
579
190
555
3
195
398
595
196
222
2
202
402
601
203
111
2
208
410
617
207
222
3
214
426
635
212
333
3
215
432
652
217
444
1
224
440
666
222
555
3
225
458
685
226
555
1
231
468
698
233
555
1
235
478
711
238
222
4
244
486
723
241
444
2
247
490
743
248

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       b,
       d-e,
       d,
       a-b
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 6,3,2,1,4,5
----
29
2
249
2
248
-4
18
1
194
-2
190
-3
24
-1
223
1
222
-3
23
3
218
-2
217
-2
21
-2
206
-2
207
-1
11
3
158
-1
156
1
13
1
167
4
169
1
16
-3
181
3
183
1
19
3
198
-1
196
1
20
-2
200
-1
203
1
25
3
228
-1
226
1
1
-1
105
-1
108
2
10
1
151
2
154
2
17
-1
186
-4
185
2
22
-3
211
2
212
2
26
1
232
3
233
2
12
-1
160
2
164
3
27
1
236
1
238
3
28
-4
240
-1
241
3
0
-2
100
-2
101
4
14
-2
170
-2
171
4
15
-1
175
1
178
4

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE a>b
    OR (e>a AND e<b)
 ORDER BY 1
----
0
1
3
6
9
10
11
12
13
14
15
16
17
18
19
20
22
24
25
26
27
28
29

query IIIIII nosort
SELECT d,
       b-c,
       a+b*2+c*3+d*4+e*5,
       a,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d>e
    OR e+d BETWEEN a+b-10 AND c+130
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,3,6,2,4,5
----
101
-2
1529
104
2
555
108
-1
1612
107
1
333
114
-1
1680
111
1
111
116
-1
1757
115
1
333
122
1
1826
121
1
333
128
4
1902
127
4
333
133
-4
1985
131
4
444
136
2
2046
138
2
111
140
2
2131
142
2
111
148
-2
2202
149
2
555
154
1
2281
153
1
333
156
3
2349
159
3
555
164
-1
2432
163
1
333
169
1
2501
168
1
333
171
-2
2579
174
2
555
178
-1
2654
179
1
555
183
-3
2728
182
3
333
185
-1
2806
188
1
444
190
1
2878
191
1
444
196
3
2949
199
3
555
203
-2
3039
201
2
222
207
-2
3114
205
2
111
212
-3
3175
213
3
222
217
3
3260
216
3
333
222
-1
3331
220
1
444
226
3
3399
229
3
555
233
1
3473
234
1
555
238
1
3553
239
1
555
241
-4
3629
243
4
222
248
2
3706
245
2
444

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5,
       d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 1,3,6,2,5,4
----
0
1529
101
1000
-2
102
0
1612
108
1050
-1
107
0
1680
114
1120
-1
112
0
1757
116
1180
-1
117
0
1826
122
1240
1
122
0
1902
128
1290
4
127
0
1985
133
1300
-4
132
0
2046
136
1390
2
137
0
2131
140
1430
2
142
0
2202
148
1450
-2
147
0
2281
154
1510
1
152
0
2349
156
1580
3
157
0
2432
164
1600
-1
162
0
2501
169
1670
1
167
0
2579
171
1700
-2
172
0
2654
178
358
-1
177
0
2728
183
364
-3
182
0
2806
185
376
-1
187
0
2878
190
382
1
192
0
2949
196
398
3
197
0
3039
203
402
-2
202
0
3114
207
410
-2
207
0
3175
212
426
-3
212
0
3260
217
432
3
217
0
3331
222
440
-1
222
0
3399
226
458
3
227
0
3473
233
468
1
232
0
3553
238
478
1
237
0
3629
241
486
-4
242
0
3706
248
490
2
247

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d,
       abs(b-c),
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND a>b
 ORDER BY 4,1,5,3,2
----
444
1
4
793
0
555
-1
3
940
0
333
-3
1
1000
0
333
1
3
1096
0
555
-1
3
1180
0
222
-1
2
1207
0
555
-1
3
1360
0

query IIIII nosort
SELECT b,
       a,
       (a+b+c+d+e)/5,
       b-c,
       e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR a>b
 ORDER BY 3,1,2,5,4
----
100
104
102
-2
103
105
107
107
-1
109
118
115
117
-1
117
129
127
127
4
126
130
131
132
-4
132
145
149
147
-2
146
151
153
152
1
152
158
159
157
3
157
160
163
162
-1
162
167
168
167
1
165
170
174
172
-2
173
175
179
177
-1
177
181
182
182
-3
180
186
188
187
-1
189
194
191
192
1
192
198
199
197
3
197
200
201
202
-2
204
211
213
212
-3
210
218
216
217
3
219
223
220
222
-1
221
228
229
227
3
227
232
234
232
1
230
236
239
237
1
237
240
243
242
-4
242

query IIIII nosort
SELECT b,
       d-e,
       (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 2,3,5,4,1
----
194
-2
192
222
191
118
-1
117
222
115
223
1
222
222
220
249
2
247
111
245

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       c,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,5,6,3,1,4
----
8
-4
1430
2
141
2131
17
-4
376
-1
187
2806
14
-2
1700
-2
172
2579
18
-2
382
1
193
2878
21
-2
410
-2
208
3114
23
-2
432
3
215
3260
1
-1
1050
-1
106
1612
3
-1
1180
-1
119
1757
11
-1
1580
3
155
2349
19
-1
398
3
195
2949
20
-1
402
-2
202
3039
25
-1
458
3
225
3399
28
-1
486
-4
244
3629
6
1
1300
-4
134
1985
7
1
1390
2
137
2046
15
1
358
-1
176
2654
24
1
440
-1
224
3331
27
1
478
1
235
3553
4
2
1240
1
123
1826
5
2
1290
4
125
1902
9
2
1450
-2
147
2202
10
2
1510
1
150
2281
12
2
1600
-1
161
2432
22
2
426
-3
214
3175
29
2
490
2
247
3706
16
3
364
-3
184
2728
26
3
468
1
231
3473
2
4
1120
-1
113
1680
13
4
1670
1
166
2501

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e,
       d,
       a-b
  FROM t1
 ORDER BY 2,3,4,5,6,1
----
1680
111
0
110
114
-1
2046
111
0
135
136
-1
2131
111
0
144
140
-1
3114
111
0
209
207
-1
3039
222
0
204
203
1
3175
222
0
210
212
2
3629
222
0
242
241
3
1612
333
0
109
108
2
1757
333
0
117
116
-3
1826
333
0
120
122
-3
1902
333
0
126
128
-2
2281
333
0
152
154
2
2432
333
0
162
164
3
2501
333
0
165
169
1
2728
333
0
180
183
1
3260
333
0
219
217
-2
1985
444
0
132
133
1
2806
444
0
189
185
2
2878
444
0
192
190
-3
3331
444
0
221
222
-3
3706
444
0
246
248
-4
1529
555
0
103
101
4
2202
555
0
146
148
4
2349
555
0
157
156
1
2579
555
0
173
171
4
2654
555
0
177
178
4
2949
555
0
197
196
1
3399
555
0
227
226
1
3473
555
0
230
233
2
3553
555
0
237
238
3

query I nosort
SELECT a+b*2+c*3
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1
----
610
635
708
760
905
940
966
1000
1030
1057
1096
1121
1158
1180
1207
1241
1277
1297
1338
1360
1391
1416
1455
1484

query IIIII nosort
SELECT b-c,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE b>c
 ORDER BY 5,4,3,1,2
----
1
1826
1240
122
4
4
1902
1290
128
5
2
2046
1390
136
7
2
2131
1430
140
8
1
2281
1510
154
10
3
2349
1580
156
11
1
2501
1670
169
13
1
2878
382
190
18
3
2949
398
196
19
3
3260
432
217
23
3
3399
458
226
25
1
3473
468
233
26
1
3553
478
238
27
2
3706
490
248
29

query II nosort
SELECT d-e,
       abs(a)
  FROM t1
 WHERE b>c
    OR a>b
 ORDER BY 1,2
----
-4
142
-4
188
-2
104
-2
174
-2
191
-2
216
-1
107
-1
159
-1
199
-1
201
-1
229
-1
243
1
131
1
138
1
179
1
239
2
121
2
127
2
149
2
153
2
163
2
213
2
245
3
182
3
234
4
168

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4
  FROM t1
 WHERE c>d
 ORDER BY 2,1,4,3
----
555
102
1000
1014
333
119
1180
1172
333
123
1240
1226
444
134
1300
1325
111
137
1390
1371
111
141
1430
1411
555
172
1700
1714
333
184
364
1828
444
187
376
1861
444
193
382
1918
111
208
410
2069
222
214
426
2125
444
224
440
2226
222
244
486
2419

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 1
----
1529
1612
1680
1757
1826
1902
1985
2046
2131
2202
2281
2349
2432
2501
2579
2654
2728
2806
2878
2949
3039
3114
3175
3260
3331
3399
3473
3553
3629
3706

query II nosort
SELECT a,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 1,2
----
104
102
107
107
111
112
115
117
121
122
127
127
131
132
138
137
142
142
149
147
153
152
159
157
163
162
168
167
174
172
179
177
182
182
188
187
191
192
199
197
201
202
205
207
213
212
216
217
220
222
229
227
234
232
239
237
243
242
245
247

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5,
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 5,3,1,2,4
----
1050
1612
107
1
635
1180
1757
115
3
708
1290
1902
127
5
760
1510
2281
153
10
905
1600
2432
163
12
966
1670
2501
168
13
1000
358
2654
179
15
1057
376
2806
188
17
1121
382
2878
191
18
1158
426
3175
213
22
1277
432
3260
216
23
1297
440
3331
220
24
1338
468
3473
234
26
1391
478
3553
239
27
1416
486
3629
243
28
1455

query II nosort
SELECT c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND c>d
 ORDER BY 1,2
----
102
555
123
333
134
444
137
111
141
111
172
555
184
333
187
444
208
111
214
222
224
444

query III nosort
SELECT a+b*2,
       a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
   AND d>e
 ORDER BY 3,1,2
----
666
-3
440
743
-4
490

query III nosort
SELECT c,
       d-e,
       (a+b+c+d+e)/5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR d NOT BETWEEN 110 AND 150
    OR (e>c OR e<d)
 ORDER BY 3,1,2
----
102
-2
102
106
-1
107
113
4
112
119
-1
117
123
2
122
125
2
127
134
1
132
137
1
137
141
-4
142
147
2
147
150
2
152
155
-1
157
161
2
162
166
4
167
172
-2
172
176
1
177
184
3
182
187
-4
187
193
-2
192
195
-1
197
202
-1
202
208
-2
207
214
2
212
215
-2
217
224
1
222
225
-1
227
231
3
232
235
1
237
244
-1
242
247
2
247

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c)
  FROM t1
 WHERE d>e
 ORDER BY 2,3,1
----
444
358
1
333
364
3
333
426
3
222
440
1
333
468
1
444
478
1
111
490
2
222
1120
1
222
1240
1
222
1290
4
333
1300
4
222
1390
2
444
1450
2
333
1510
1
444
1600
1
333
1670
1

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a,
       (a+b+c+d+e)/5,
       c,
       a+b*2+c*3+d*4
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,5,1,4,2
----
0
104
102
102
1014
1
107
107
106
1067
2
111
112
113
1130
4
121
122
123
1226
5
127
127
125
1272
6
131
132
134
1325
7
138
137
137
1371
8
142
142
141
1411
9
149
147
147
1472
10
153
152
150
1521
11
159
157
155
1564
12
163
162
161
1622
13
168
167
166
1676
14
174
172
172
1714
15
179
177
176
1769
16
182
182
184
1828
17
188
187
187
1861
19
199
197
195
1964
20
201
202
202
2019
21
205
207
208
2069
22
213
212
214
2125
23
216
217
215
2165
24
220
222
224
2226
25
229
227
225
2264
26
234
232
231
2323
27
239
237
235
2368
29
245
247
247
2476

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(a)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 2,1
----
3
115
18
191
24
220
29
245

query IIII nosort
SELECT a+b*2,
       abs(b-c),
       b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 3,2,1,4
----
391
4
-4
6
723
4
-4
28
544
3
-3
16
635
3
-3
22
304
2
-2
0
439
2
-2
9
514
2
-2
14
601
2
-2
20
617
2
-2
21
317
1
-1
1
335
1
-1
2
351
1
-1
3
483
1
-1
12
529
1
-1
15
560
1
-1
17
666
1
-1
24
369
1
1
4
455
1
1
10
502
1
1
13
579
1
1
18
698
1
1
26
711
1
1
27
416
2
2
7
428
2
2
8
743
2
2
29
475
3
3
11
595
3
3
19
652
3
3
23
685
3
3
25
385
4
4
5

query IIIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a+b*2+c*3+d*4,
       e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a,
       (a+b+c+d+e)/5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 6,7,4,1,5,3,2
----
1529
1014
103
1000
104
102
444
1612
1067
109
1050
107
107
333
1680
1130
110
1120
111
112
222
1757
1172
117
1180
115
117
222
1826
1226
120
1240
121
122
222
1902
1272
126
1290
127
127
222
1985
1325
132
1300
131
132
333
2046
1371
135
1390
138
137
222
2131
1411
144
1430
142
142
222
2202
1472
146
1450
149
147
444
2281
1521
152
1510
153
152
333
2349
1564
157
1580
159
157
333
2432
1622
162
1600
163
162
444
2501
1676
165
1670
168
167
333
2579
1714
173
1700
174
172
444
2654
1769
177
358
179
177
444
2728
1828
180
364
182
182
333
2806
1861
189
376
188
187
333
2878
1918
192
382
191
192
222
2949
1964
197
398
199
197
333
3039
2019
204
402
201
202
333
3114
2069
209
410
205
207
222
3175
2125
210
426
213
212
333
3260
2165
219
432
216
217
222
3331
2226
221
440
220
222
222
3399
2264
227
458
229
227
333
3473
2323
230
468
234
232
333
3553
2368
237
478
239
237
444
3629
2419
242
486
243
242
444
3706
2476
246
490
245
247
111

query II nosort
SELECT abs(a),
       d-e
  FROM t1
 ORDER BY 1,2
----
104
-2
107
-1
111
4
115
-1
121
2
127
2
131
1
138
1
142
-4
149
2
153
2
159
-1
163
2
168
4
174
-2
179
1
182
3
188
-4
191
-2
199
-1
201
-1
205
-2
213
2
216
-2
220
1
229
-1
234
3
239
1
243
-1
245
2

query IIIII nosort
SELECT abs(b-c),
       b-c,
       a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a
  FROM t1
 ORDER BY 3,4,2,1,5
----
2
-2
610
1000
104
1
-1
635
1050
107
1
-1
674
1120
111
1
-1
708
1180
115
1
1
738
1240
121
4
4
760
1290
127
4
-4
793
1300
131
2
2
827
1390
138
2
2
851
1430
142
2
-2
880
1450
149
1
1
905
1510
153
3
3
940
1580
159
1
-1
966
1600
163
1
1
1000
1670
168
2
-2
1030
1700
174
1
-1
1057
358
179
3
-3
1096
364
182
1
-1
1121
376
188
1
1
1158
382
191
3
3
1180
398
199
2
-2
1207
402
201
2
-2
1241
410
205
3
-3
1277
426
213
3
3
1297
432
216
1
-1
1338
440
220
3
3
1360
458
229
1
1
1391
468
234
1
1
1416
478
239
4
-4
1455
486
243
2
2
1484
490
245

query II nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4
  FROM t1
 WHERE b>c
   AND a>b
 ORDER BY 1,2
----
905
1521
940
1564
1000
1676
1180
1964
1360
2264
1391
2323
1416
2368

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4+e*5,
       d-e,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(b-c)
  FROM t1
 WHERE b>c
 ORDER BY 6,5,3,2,4,1
----
444
2878
-2
3
0
1
555
3553
1
-3
0
1
333
1826
2
1
0
1
333
2281
2
-4
0
1
555
3473
3
-2
0
1
333
2501
4
-3
0
1
111
2131
-4
1
0
2
111
2046
1
1
0
2
444
3706
2
-1
0
2
333
3260
-2
-2
0
3
555
2349
-1
-1
0
3
555
2949
-1
-1
0
3
555
3399
-1
-1
0
3
333
1902
2
-3
0
4

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a-b
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR d>e
 ORDER BY 1,2
----
358
4
364
1
376
2
382
-3
398
1
402
1
410
-1
426
2
432
-2
440
-3
458
1
468
2
478
3
486
3
490
-4
1050
2
1120
-1
1180
-3
1240
-3
1290
-2
1300
1
1390
-1
1430
-1
1450
4
1510
2
1580
1
1600
3
1670
1
1700
4

query I nosort
SELECT a-b
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----
-3
-3
-2
-1
2

query IIIIII nosort
SELECT a+b*2+c*3,
       d,
       b-c,
       a,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2
  FROM t1
 ORDER BY 4,3,6,1,2,5
----
610
101
-2
104
444
304
635
108
-1
107
333
317
674
114
-1
111
222
335
708
116
-1
115
222
351
738
122
1
121
222
369
760
128
4
127
222
385
793
133
-4
131
333
391
827
136
2
138
222
416
851
140
2
142
222
428
880
148
-2
149
444
439
905
154
1
153
333
455
940
156
3
159
333
475
966
164
-1
163
444
483
1000
169
1
168
333
502
1030
171
-2
174
444
514
1057
178
-1
179
444
529
1096
183
-3
182
333
544
1121
185
-1
188
333
560
1158
190
1
191
222
579
1180
196
3
199
333
595
1207
203
-2
201
333
601
1241
207
-2
205
222
617
1277
212
-3
213
333
635
1297
217
3
216
222
652
1338
222
-1
220
222
666
1360
226
3
229
333
685
1391
233
1
234
333
698
1416
238
1
239
444
711
1455
241
-4
243
444
723
1484
248
2
245
111
743

query IIIIII nosort
SELECT a-b,
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       (a+b+c+d+e)/5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR b>c
 ORDER BY 1,4,2,5,6,3
----
-4
248
0
1484
3706
247
-3
116
0
708
1757
117
-3
122
0
738
1826
122
-3
190
0
1158
2878
192
-3
222
0
1338
3331
222
-2
128
0
760
1902
127
-2
217
0
1297
3260
217
-1
114
0
674
1680
112
-1
136
0
827
2046
137
-1
140
0
851
2131
142
-1
207
0
1241
3114
207
1
133
0
793
1985
132
1
156
0
940
2349
157
1
169
0
1000
2501
167
1
183
0
1096
2728
182
1
196
0
1180
2949
197
1
203
0
1207
3039
202
1
226
0
1360
3399
227
2
108
0
635
1612
107
2
154
0
905
2281
152
2
185
0
1121
2806
187
2
212
0
1277
3175
212
2
233
0
1391
3473
232
3
164
0
966
2432
162
3
238
0
1416
3553
237
3
241
0
1455
3629
242
4
148
0
880
2202
147
4
171
0
1030
2579
172
4
178
0
1057
2654
177

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4,
       a-b,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (a>b-2 AND a<b+2)
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1,3,4,5,2
----
222
1130
-1
110
2

query IIIIIII nosort
SELECT c,
       abs(a),
       d,
       b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a
  FROM t1
 ORDER BY 1,4,3,5,6,7,2
----
102
104
101
100
555
0
104
106
107
108
105
333
1
107
113
111
114
112
111
2
111
119
115
116
118
333
3
115
123
121
122
124
333
4
121
125
127
128
129
333
5
127
134
131
133
130
444
6
131
137
138
136
139
111
7
138
141
142
140
143
111
8
142
147
149
148
145
555
9
149
150
153
154
151
333
10
153
155
159
156
158
555
11
159
161
163
164
160
333
12
163
166
168
169
167
333
13
168
172
174
171
170
555
14
174
176
179
178
175
555
15
179
184
182
183
181
333
16
182
187
188
185
186
444
17
188
193
191
190
194
444
18
191
195
199
196
198
555
19
199
202
201
203
200
222
20
201
208
205
207
206
111
21
205
214
213
212
211
222
22
213
215
216
217
218
333
23
216
224
220
222
223
444
24
220
225
229
226
228
555
25
229
231
234
233
232
555
26
234
235
239
238
236
555
27
239
244
243
241
240
222
28
243
247
245
248
249
444
29
245

query IIIIII nosort
SELECT d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c,
       a+b*2+c*3,
       b
  FROM t1
 WHERE b>c
    OR c>d
 ORDER BY 3,5,6,4,2,1
----
136
7
111
137
827
139
140
8
111
141
851
143
207
21
111
208
1241
206
212
22
222
214
1277
211
241
28
222
244
1455
240
116
3
333
119
708
118
122
4
333
123
738
124
128
5
333
125
760
129
154
10
333
150
905
151
169
13
333
166
1000
167
183
16
333
184
1096
181
217
23
333
215
1297
218
133
6
444
134
793
130
185
17
444
187
1121
186
190
18
444
193
1158
194
222
24
444
224
1338
223
248
29
444
247
1484
249
101
0
555
102
610
100
156
11
555
155
940
158
171
14
555
172
1030
170
196
19
555
195
1180
198
226
25
555
225
1360
228
233
26
555
231
1391
232
238
27
555
235
1416
236

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       (a+b+c+d+e)/5
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,1,2
----
333
107
107
111
111
112
333
115
117
333
121
122
333
127
127
444
131
132
111
138
137
111
142
142
555
149
147
333
153
152
555
159
157
333
163
162
333
168
167
555
174
172
555
179
177
333
182
182
444
188
187
444
191
192
555
199
197
222
201
202
111
205
207
222
213
212
333
216
217
444
220
222
555
229
227
555
234
232
555
239
237
222
243
242
444
245
247

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e
  FROM t1
 WHERE b>c
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND c>d
 ORDER BY 1,2
----
382
192
1240
120
1390
135
1430
144

query II nosort
SELECT abs(a),
       a-b
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND c BETWEEN b-2 AND d+2
   AND (e>a AND e<b)
 ORDER BY 1,2
----
220
-3
245
-4

query II nosort
SELECT abs(a),
       c-d
  FROM t1
 WHERE d>e
    OR b>c
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 2,1
----
153
-4
127
-3
163
-3
168
-3
239
-3
107
-2
179
-2
216
-2
234
-2
111
-1
149
-1
159
-1
199
-1
201
-1
229
-1
245
-1
104
1
121
1
131
1
138
1
142
1
174
1
182
1
205
1
188
2
213
2
220
2
191
3
243
3

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d
  FROM t1
 WHERE b>c
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (e>c OR e<d)
 ORDER BY 6,2,1,3,5,4
----
4
123
1826
222
0
122
5
125
1902
222
0
128
7
137
2046
222
0
136
8
141
2131
222
0
140
10
150
2281
333
0
154
11
155
2349
333
0
156
13
166
2501
333
0
169
19
195
2949
333
0
196
23
215
3260
222
0
217
25
225
3399
333
0
226
26
231
3473
333
0
233
27
235
3553
444
0
238
29
247
3706
111
0
248

query II nosort
SELECT a+b*2+c*3+d*4+e*5,
       a+b*2+c*3
  FROM t1
 WHERE b>c
    OR c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
 ORDER BY 2,1
----
1529
610
1612
635
1680
674
1826
738
1902
760
1985
793
2046
827
2131
851
2202
880
2281
905
2349
940
2432
966
2501
1000
2579
1030
2654
1057
2728
1096
2806
1121
2878
1158
2949
1180
3039
1207
3114
1241
3175
1277
3260
1297
3331
1338
3399
1360
3473
1391
3553
1416
3706
1484

query IIII nosort
SELECT b,
       a+b*2+c*3,
       abs(b-c),
       a-b
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,1,2,4
----
105
635
1
2
112
674
1
-1
124
738
1
-3
151
905
1
2
160
966
1
3
167
1000
1
1
175
1057
1
4
186
1121
1
2
223
1338
1
-3
232
1391
1
2
236
1416
1
3
100
610
2
4
139
827
2
-1
143
851
2
-1
145
880
2
4
170
1030
2
4
200
1207
2
1
206
1241
2
-1
249
1484
2
-4
158
940
3
1
181
1096
3
1
198
1180
3
1
211
1277
3
2
218
1297
3
-2
228
1360
3
1
129
760
4
-2
130
793
4
1

query IIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3,
       d,
       b
  FROM t1
 ORDER BY 2,1,3,4
----
1000
610
101
100
1050
635
108
105
1120
674
114
112
1180
708
116
118
1240
738
122
124
1290
760
128
129
1300
793
133
130
1390
827
136
139
1430
851
140
143
1450
880
148
145
1510
905
154
151
1580
940
156
158
1600
966
164
160
1670
1000
169
167
1700
1030
171
170
358
1057
178
175
364
1096
183
181
376
1121
185
186
382
1158
190
194
398
1180
196
198
402
1207
203
200
410
1241
207
206
426
1277
212
211
432
1297
217
218
440
1338
222
223
458
1360
226
228
468
1391
233
232
478
1416
238
236
486
1455
241
240
490
1484
248
249

query I nosort
SELECT c-d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1
----
-3
-1
-1
-1
-1
-1
1
1
1
1
1

query IIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c)
  FROM t1
 WHERE c>d
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 4,3,5,2,1
----
1757
0
117
333
1
1826
0
120
333
1

query II nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,2
----
111
222
222
333
222
333
222
444
333
222
333
333
333
333
333
333
333
333
333
444
444
111
444
222
444
222
444
333
555
333
555
333
555
333
555
333
555
444
555
444
555
444
555
444

query III nosort
SELECT a+b*2+c*3,
       a-b,
       c-d
  FROM t1
 WHERE a>b
 ORDER BY 1,3,2
----
610
4
1
635
2
-2
793
1
1
880
4
-1
905
2
-4
940
1
-1
966
3
-3
1000
1
-3
1030
4
1
1057
4
-2
1096
1
1
1121
2
2
1180
1
-1
1207
1
-1
1277
2
2
1360
1
-1
1391
2
-2
1416
3
-3
1455
3
3

query IIIII nosort
SELECT d,
       a+b*2+c*3,
       a+b*2,
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4
  FROM t1
 WHERE (e>a AND e<b)
   AND d>e
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,3,5,4
----
222
1338
666
222
2226
248
1484
743
247
2476

query IIIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       c,
       d-e,
       a+b*2+c*3+d*4+e*5,
       d,
       a-b
  FROM t1
 ORDER BY 3,1,7,6,4,2,5
----
444
610
102
-2
1529
101
4
333
635
106
-1
1612
108
2
222
674
113
4
1680
114
-1
222
708
119
-1
1757
116
-3
222
738
123
2
1826
122
-3
222
760
125
2
1902
128
-2
333
793
134
1
1985
133
1
222
827
137
1
2046
136
-1
222
851
141
-4
2131
140
-1
444
880
147
2
2202
148
4
333
905
150
2
2281
154
2
333
940
155
-1
2349
156
1
444
966
161
2
2432
164
3
333
1000
166
4
2501
169
1
444
1030
172
-2
2579
171
4
444
1057
176
1
2654
178
4
333
1096
184
3
2728
183
1
333
1121
187
-4
2806
185
2
222
1158
193
-2
2878
190
-3
333
1180
195
-1
2949
196
1
333
1207
202
-1
3039
203
1
222
1241
208
-2
3114
207
-1
333
1277
214
2
3175
212
2
222
1297
215
-2
3260
217
-2
222
1338
224
1
3331
222
-3
333
1360
225
-1
3399
226
1
333
1391
231
3
3473
233
2
444
1416
235
1
3553
238
3
444
1455
244
-1
3629
241
3
111
1484
247
2
3706
248
-4

query IIII nosort
SELECT c-d,
       e,
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 4,1,3,2
----
1
103
102
1529
-2
109
107
1612
-1
110
112
1680
3
117
117
1757
1
120
122
1826
-3
126
127
1902
1
132
132
1985
1
135
137
2046
1
144
142
2131
-1
146
147
2202
-4
152
152
2281
-1
157
157
2349
-3
162
162
2432
-3
165
167
2501
1
173
172
2579
-2
177
177
2654
1
180
182
2728
2
189
187
2806
3
192
192
2878
-1
197
197
2949
-1
204
202
3039
1
209
207
3114
2
210
212
3175
-2
219
217
3260
2
221
222
3331
-1
227
227
3399
-2
230
232
3473
-3
237
237
3553
3
242
242
3629
-1
246
247
3706

query III nosort
SELECT a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a
  FROM t1
 ORDER BY 1,2,3
----
1014
0
104
1067
0
107
1130
0
111
1172
0
115
1226
0
121
1272
0
127
1325
0
131
1371
0
138
1411
0
142
1472
0
149
1521
0
153
1564
0
159
1622
0
163
1676
0
168
1714
0
174
1769
0
179
1828
0
182
1861
0
188
1918
0
191
1964
0
199
2019
0
201
2069
0
205
2125
0
213
2165
0
216
2226
0
220
2264
0
229
2323
0
234
2368
0
239
2419
0
243
2476
0
245

query IIIIIII nosort
SELECT e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(a),
       c
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND b>c
   AND (e>a AND e<b)
 ORDER BY 4,6,2,5,7,3,1
----

query II nosort
SELECT c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (e>a AND e<b)
   AND b>c
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1,2
----
193
222

query II nosort
SELECT b-c,
       c
  FROM t1
 ORDER BY 1,2
----
-4
134
-4
244
-3
184
-3
214
-2
102
-2
147
-2
172
-2
202
-2
208
-1
106
-1
113
-1
119
-1
161
-1
176
-1
187
-1
224
1
123
1
150
1
166
1
193
1
231
1
235
2
137
2
141
2
247
3
155
3
195
3
215
3
225
4
125

query IIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3+d*4,
       a+b*2+c*3,
       c-d
  FROM t1
 WHERE (e>a AND e<b)
    OR (e>c OR e<d)
    OR c>d
 ORDER BY 3,2,6,5,4,1
----
555
1000
1529
1014
610
1
333
1050
1612
1067
635
-2
111
1120
1680
1130
674
-1
333
1180
1757
1172
708
3
333
1240
1826
1226
738
1
333
1290
1902
1272
760
-3
444
1300
1985
1325
793
1
111
1390
2046
1371
827
1
111
1430
2131
1411
851
1
555
1450
2202
1472
880
-1
333
1510
2281
1521
905
-4
555
1580
2349
1564
940
-1
333
1600
2432
1622
966
-3
333
1670
2501
1676
1000
-3
555
1700
2579
1714
1030
1
555
358
2654
1769
1057
-2
333
364
2728
1828
1096
1
444
376
2806
1861
1121
2
444
382
2878
1918
1158
3
555
398
2949
1964
1180
-1
222
402
3039
2019
1207
-1
111
410
3114
2069
1241
1
222
426
3175
2125
1277
2
333
432
3260
2165
1297
-2
444
440
3331
2226
1338
2
555
458
3399
2264
1360
-1
555
468
3473
2323
1391
-2
555
478
3553
2368
1416
-3
222
486
3629
2419
1455
3
444
490
3706
2476
1484
-1

query I nosort
SELECT d
  FROM t1
 WHERE d>e
 ORDER BY 1
----
114
122
128
133
136
148
154
164
169
178
183
212
222
233
238
248

query IIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a-b
  FROM t1
 ORDER BY 4,3,2,1
----
3706
245
444
-4
1757
115
333
-3
1826
121
333
-3
2878
191
444
-3
3331
220
444
-3
1902
127
333
-2
3260
216
333
-2
1680
111
111
-1
2046
138
111
-1
2131
142
111
-1
3114
205
111
-1
3039
201
222
1
2501
168
333
1
2728
182
333
1
1985
131
444
1
2349
159
555
1
2949
199
555
1
3399
229
555
1
3175
213
222
2
1612
107
333
2
2281
153
333
2
2806
188
444
2
3473
234
555
2
3629
243
222
3
2432
163
333
3
3553
239
555
3
1529
104
555
4
2202
149
555
4
2579
174
555
4
2654
179
555
4

query IIIIII nosort
SELECT abs(a),
       e,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND b>c
 ORDER BY 5,3,6,1,4,2
----
153
152
-4
10
0
333
168
165
-3
13
0
333
239
237
-3
27
0
444
234
230
-2
26
0
333
245
246
-1
29
0
111
121
120
1
4
0
222
138
135
1
7
0
222
142
144
1
8
0
222

query IIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       b-c,
       abs(a)
  FROM t1
 ORDER BY 4,1,3,2
----
1000
444
-2
104
1050
333
-1
107
1120
222
-1
111
1180
222
-1
115
1240
222
1
121
1290
222
4
127
1300
333
-4
131
1390
222
2
138
1430
222
2
142
1450
444
-2
149
1510
333
1
153
1580
333
3
159
1600
444
-1
163
1670
333
1
168
1700
444
-2
174
358
444
-1
179
364
333
-3
182
376
333
-1
188
382
222
1
191
398
333
3
199
402
333
-2
201
410
222
-2
205
426
333
-3
213
432
222
3
216
440
222
-1
220
458
333
3
229
468
333
1
234
478
444
1
239
486
444
-4
243
490
111
2
245

query IIII nosort
SELECT d,
       abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a
  FROM t1
 WHERE a>b
 ORDER BY 1,3,4,2
----
101
104
555
104
108
107
333
107
133
131
444
131
148
149
555
149
154
153
333
153
156
159
555
159
164
163
333
163
169
168
333
168
171
174
555
174
178
179
555
179
183
182
333
182
185
188
444
188
196
199
555
199
203
201
222
201
212
213
222
213
226
229
555
229
233
234
555
234
238
239
555
239
241
243
222
243

query III nosort
SELECT abs(a),
       a+b*2+c*3,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 3,1,2
----
104
610
102
107
635
107
111
674
112
115
708
117
121
738
122
127
760
127
131
793
132
138
827
137
142
851
142
149
880
147
153
905
152
159
940
157
163
966
162
168
1000
167
174
1030
172
179
1057
177
182
1096
182
188
1121
187
191
1158
192
199
1180
197
201
1207
202
205
1241
207
213
1277
212
216
1297
217
220
1338
222
229
1360
227
234
1391
232
239
1416
237
243
1455
242
245
1484
247

query IIIIII nosort
SELECT c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3,
       c,
       abs(a)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (e>a AND e<b)
 ORDER BY 2,4,1,3,5,6
----
-1
111
444
1484
247
245
-1
222
111
674
113
111
3
222
333
708
119
115
1
222
333
738
123
121
-3
222
333
760
125
127
3
222
444
1158
193
191
2
222
444
1338
224
220
-2
333
333
635
106
107
1
444
555
610
102
104

query II nosort
SELECT d,
       a+b*2
  FROM t1
 WHERE b>c
    OR c BETWEEN b-2 AND d+2
    OR (a>b-2 AND a<b+2)
 ORDER BY 1,2
----
101
304
108
317
114
335
122
369
128
385
133
391
136
416
140
428
148
439
154
455
156
475
164
483
169
502
171
514
178
529
183
544
185
560
190
579
196
595
203
601
207
617
212
635
217
652
222
666
226
685
233
698
238
711
248
743

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE a>b
    OR c BETWEEN b-2 AND d+2
    OR (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
29
111
2
222
4
222
7
222
8
222
21
222
24
222
1
333
6
333
10
333
11
333
13
333
16
333
17
333
19
333
20
333
22
333
25
333
26
333
0
444
9
444
12
444
14
444
15
444
27
444
28
444

query I nosort
SELECT b
  FROM t1
 WHERE d>e
    OR (e>a AND e<b)
    OR (a>b-2 AND a<b+2)
 ORDER BY 1
----
112
118
124
129
130
139
143
145
151
158
160
167
175
181
194
198
200
206
211
223
228
232
236
249

query III nosort
SELECT (a+b+c+d+e)/5,
       b-c,
       a
  FROM t1
 ORDER BY 3,1,2
----
102
-2
104
107
-1
107
112
-1
111
117
-1
115
122
1
121
127
4
127
132
-4
131
137
2
138
142
2
142
147
-2
149
152
1
153
157
3
159
162
-1
163
167
1
168
172
-2
174
177
-1
179
182
-3
182
187
-1
188
192
1
191
197
3
199
202
-2
201
207
-2
205
212
-3
213
217
3
216
222
-1
220
227
3
229
232
1
234
237
1
239
242
-4
243
247
2
245

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a)
  FROM t1
 ORDER BY 1,2
----
0
104
0
107
0
111
0
115
0
121
0
127
0
131
0
138
0
142
0
149
0
153
0
159
0
163
0
168
0
174
0
179
0
182
0
188
0
191
0
199
0
201
0
205
0
213
0
216
0
220
0
229
0
234
0
239
0
243
0
245

query IIII nosort
SELECT abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c,
       e
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (e>c OR e<d)
 ORDER BY 3,2,4,1
----
104
1000
102
103
107
1050
106
109
111
1120
113
110
115
1180
119
117
121
1240
123
120
127
1290
125
126
131
1300
134
132
138
1390
137
135
142
1430
141
144
149
1450
147
146
153
1510
150
152
159
1580
155
157
163
1600
161
162
168
1670
166
165
174
1700
172
173
179
358
176
177
182
364
184
180
188
376
187
189
199
398
195
197
201
402
202
204
205
410
208
209
213
426
214
210
216
432
215
219
220
440
224
221
229
458
225
227
234
468
231
230
239
478
235
237
245
490
247
246

query IIIIIII nosort
SELECT a+b*2+c*3+d*4,
       d-e,
       a+b*2+c*3,
       abs(b-c),
       d,
       b-c,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,7,1,6,5,2,4
----
1014
-2
610
2
101
-2
1529
1067
-1
635
1
108
-1
1612
1130
4
674
1
114
-1
1680
1226
2
738
1
122
1
1826
1272
2
760
4
128
4
1902
1325
1
793
4
133
-4
1985
1371
1
827
2
136
2
2046
1411
-4
851
2
140
2
2131
1472
2
880
2
148
-2
2202
1521
2
905
1
154
1
2281
1564
-1
940
3
156
3
2349
1622
2
966
1
164
-1
2432
1676
4
1000
1
169
1
2501
1714
-2
1030
2
171
-2
2579
1769
1
1057
1
178
-1
2654
1828
3
1096
3
183
-3
2728
1861
-4
1121
1
185
-1
2806
1964
-1
1180
3
196
3
2949
2019
-1
1207
2
203
-2
3039
2069
-2
1241
2
207
-2
3114
2125
2
1277
3
212
-3
3175
2165
-2
1297
3
217
3
3260
2226
1
1338
1
222
-1
3331
2264
-1
1360
3
226
3
3399
2323
3
1391
1
233
1
3473
2368
1
1416
1
238
1
3553
2476
2
1484
2
248
2
3706

query III nosort
SELECT c-d,
       b-c,
       abs(b-c)
  FROM t1
 WHERE d>e
 ORDER BY 1,2,3
----
-4
1
1
-3
-1
1
-3
1
1
-3
1
1
-3
4
4
-2
-1
1
-2
1
1
-1
-2
2
-1
-1
1
-1
2
2
1
-4
4
1
-3
3
1
1
1
1
2
2
2
-3
3
2
-1
1

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d
  FROM t1
 WHERE a>b
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 5,3,1,4,2
----
10
333
151
1510
-4
5
333
129
1290
-3
12
333
160
1600
-3
13
333
167
1670
-3
27
555
236
478
-3
1
333
105
1050
-2
15
555
175
358
-2
26
555
232
468
-2
2
111
112
1120
-1
9
555
145
1450
-1
11
555
158
1580
-1
19
555
198
398
-1
20
222
200
402
-1
25
555
228
458
-1
0
555
100
1000
1
4
333
124
1240
1
6
444
130
1300
1
14
555
170
1700
1
16
333
181
364
1
17
444
186
376
2
22
222
211
426
2
3
333
118
1180
3
28
222
240
486
3

query IIIIII nosort
SELECT b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b
  FROM t1
 ORDER BY 2,6,3,1,4,5
----
-2
0
101
1529
0
100
-1
0
108
1612
1
105
-1
0
114
1680
2
112
-1
0
116
1757
3
118
1
0
122
1826
4
124
4
0
128
1902
5
129
-4
0
133
1985
6
130
2
0
136
2046
7
139
2
0
140
2131
8
143
-2
0
148
2202
9
145
1
0
154
2281
10
151
3
0
156
2349
11
158
-1
0
164
2432
12
160
1
0
169
2501
13
167
-2
0
171
2579
14
170
-1
0
178
2654
15
175
-3
0
183
2728
16
181
-1
0
185
2806
17
186
1
0
190
2878
18
194
3
0
196
2949
19
198
-2
0
203
3039
20
200
-2
0
207
3114
21
206
-3
0
212
3175
22
211
3
0
217
3260
23
218
-1
0
222
3331
24
223
3
0
226
3399
25
228
1
0
233
3473
26
232
1
0
238
3553
27
236
-4
0
241
3629
28
240
2
0
248
3706
29
249

query III nosort
SELECT e,
       a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE a>b
 ORDER BY 1,2,3
----
103
610
0
109
635
0
132
793
0
146
880
0
152
905
0
157
940
0
162
966
0
165
1000
0
173
1030
0
177
1057
0
180
1096
0
189
1121
0
197
1180
0
204
1207
0
210
1277
0
227
1360
0
230
1391
0
237
1416
0
242
1455
0

query II nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 2,1
----
333
1
333
1
333
1
333
1
444
1
444
1
444
1
555
1
555
1
555
1
111
2
222
2
444
2
555
2
555
2
222
3
333
3
333
3
555
3
555
3
555
3
222
4

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       a,
       a+b*2
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 2,1,3
----
1612
107
317
1757
115
351
1902
127
385
2281
153
455
2432
163
483
2501
168
502
2654
179
529
2806
188
560
2878
191
579
3175
213
635
3260
216
652
3331
220
666
3473
234
698
3553
239
711
3629
243
723

query I nosort
SELECT b
  FROM t1
 WHERE a>b
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (e>c OR e<d)
 ORDER BY 1
----
100
105
112
118
124
129
130
139
143
145
151
158
160
167
170
175
181
186
194
198
200
206
211
218
223
228
232
236
240
249

query IIII nosort
SELECT a+b*2+c*3,
       c-d,
       d,
       a
  FROM t1
 ORDER BY 3,2,1,4
----
610
1
101
104
635
-2
108
107
674
-1
114
111
708
3
116
115
738
1
122
121
760
-3
128
127
793
1
133
131
827
1
136
138
851
1
140
142
880
-1
148
149
905
-4
154
153
940
-1
156
159
966
-3
164
163
1000
-3
169
168
1030
1
171
174
1057
-2
178
179
1096
1
183
182
1121
2
185
188
1158
3
190
191
1180
-1
196
199
1207
-1
203
201
1241
1
207
205
1277
2
212
213
1297
-2
217
216
1338
2
222
220
1360
-1
226
229
1391
-2
233
234
1416
-3
238
239
1455
3
241
243
1484
-1
248
245

query IIIIII nosort
SELECT b-c,
       a+b*2+c*3+d*4,
       c-d,
       a,
       d-e,
       c
  FROM t1
 WHERE d>e
 ORDER BY 3,4,1,5,6,2
----
1
1521
-4
153
2
150
4
1272
-3
127
2
125
-1
1622
-3
163
2
161
1
1676
-3
168
4
166
1
2368
-3
239
1
235
-1
1769
-2
179
1
176
1
2323
-2
234
3
231
-1
1130
-1
111
4
113
-2
1472
-1
149
2
147
2
2476
-1
245
2
247
1
1226
1
121
2
123
-4
1325
1
131
1
134
2
1371
1
138
1
137
-3
1828
1
182
3
184
-3
2125
2
213
2
214
-1
2226
2
220
1
224

query IIII nosort
SELECT c-d,
       c,
       abs(a),
       a+b*2+c*3
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (e>c OR e<d)
 ORDER BY 1,4,2,3
----
-4
150
153
905
-3
161
163
966
-3
166
168
1000
-3
235
239
1416
-2
106
107
635
-2
176
179
1057
-2
231
234
1391
-1
113
111
674
-1
147
149
880
-1
202
201
1207
-1
247
245
1484
1
102
104
610
1
123
121
738
1
134
131
793
1
137
138
827
1
141
142
851
1
172
174
1030
1
184
182
1096
1
208
205
1241
2
187
188
1121
2
214
213
1277
2
224
220
1338

query III nosort
SELECT d-e,
       abs(b-c),
       (a+b+c+d+e)/5
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (e>a AND e<b)
 ORDER BY 2,3,1
----
-1
1
117
-2
1
192
1
1
222

query IIII nosort
SELECT b-c,
       d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 2,3,1,4
----
-1
114
0
111
-4
133
0
444
2
136
0
111
2
140
0
111
3
156
0
555
1
169
0
333
-3
183
0
333
3
196
0
555
-2
203
0
222
-2
207
0
111
3
226
0
555

query IIIIII nosort
SELECT abs(a),
       a,
       c,
       d-e,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 1,6,3,5,4,2
----
104
104
102
-2
304
0
107
107
106
-1
317
1
111
111
113
4
335
2
115
115
119
-1
351
3
121
121
123
2
369
4
127
127
125
2
385
5
131
131
134
1
391
6
138
138
137
1
416
7
142
142
141
-4
428
8
149
149
147
2
439
9
153
153
150
2
455
10
159
159
155
-1
475
11
163
163
161
2
483
12
168
168
166
4
502
13
174
174
172
-2
514
14
179
179
176
1
529
15
182
182
184
3
544
16
188
188
187
-4
560
17
191
191
193
-2
579
18
199
199
195
-1
595
19
201
201
202
-1
601
20
205
205
208
-2
617
21
213
213
214
2
635
22
216
216
215
-2
652
23
220
220
224
1
666
24
229
229
225
-1
685
25
234
234
231
3
698
26
239
239
235
1
711
27
243
243
244
-1
723
28
245
245
247
2
743
29

query IIIIIII nosort
SELECT a-b,
       c,
       a+b*2+c*3,
       b,
       d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d
  FROM t1
 ORDER BY 4,3,5,6,2,1,7
----
4
102
610
100
101
1000
1
2
106
635
105
108
1050
-2
-1
113
674
112
114
1120
-1
-3
119
708
118
116
1180
3
-3
123
738
124
122
1240
1
-2
125
760
129
128
1290
-3
1
134
793
130
133
1300
1
-1
137
827
139
136
1390
1
-1
141
851
143
140
1430
1
4
147
880
145
148
1450
-1
2
150
905
151
154
1510
-4
1
155
940
158
156
1580
-1
3
161
966
160
164
1600
-3
1
166
1000
167
169
1670
-3
4
172
1030
170
171
1700
1
4
176
1057
175
178
358
-2
1
184
1096
181
183
364
1
2
187
1121
186
185
376
2
-3
193
1158
194
190
382
3
1
195
1180
198
196
398
-1
1
202
1207
200
203
402
-1
-1
208
1241
206
207
410
1
2
214
1277
211
212
426
2
-2
215
1297
218
217
432
-2
-3
224
1338
223
222
440
2
1
225
1360
228
226
458
-1
2
231
1391
232
233
468
-2
3
235
1416
236
238
478
-3
3
244
1455
240
241
486
3
-4
247
1484
249
248
490
-1

query IIIII nosort
SELECT a,
       d-e,
       c,
       a+b*2,
       e
  FROM t1
 WHERE a>b
    OR c>d
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 2,3,5,4,1
----
142
-4
141
428
144
188
-4
187
560
189
104
-2
102
304
103
174
-2
172
514
173
191
-2
193
579
192
205
-2
208
617
209
216
-2
215
652
219
107
-1
106
317
109
115
-1
119
351
117
159
-1
155
475
157
199
-1
195
595
197
201
-1
202
601
204
229
-1
225
685
227
243
-1
244
723
242
131
1
134
391
132
138
1
137
416
135
179
1
176
529
177
220
1
224
666
221
239
1
235
711
237
121
2
123
369
120
127
2
125
385
126
149
2
147
439
146
153
2
150
455
152
163
2
161
483
162
213
2
214
635
210
182
3
184
544
180
234
3
231
698
230
168
4
166
502
165

query IIIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       c,
       a,
       a+b*2
  FROM t1
 WHERE (e>a AND e<b)
   AND (e>c OR e<d)
 ORDER BY 3,6,2,1,5,7,4
----
444
-1
221
24
224
220
666
444
2
246
29
247
245
743

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 2,3,1,5,4
----
444
304
0
1529
1014
333
317
1
1612
1067
222
335
2
1680
1130
222
351
3
1757
1172
222
369
4
1826
1226
222
385
5
1902
1272
333
391
6
1985
1325
222
416
7
2046
1371
222
428
8
2131
1411
444
439
9
2202
1472
333
455
10
2281
1521
333
475
11
2349
1564
444
483
12
2432
1622
333
502
13
2501
1676
444
514
14
2579
1714
444
529
15
2654
1769
333
544
16
2728
1828
333
560
17
2806
1861
222
579
18
2878
1918
333
595
19
2949
1964
333
601
20
3039
2019
222
617
21
3114
2069
333
635
22
3175
2125
222
652
23
3260
2165
222
666
24
3331
2226
333
685
25
3399
2264
333
698
26
3473
2323
444
711
27
3553
2368
444
723
28
3629
2419
111
743
29
3706
2476

query IIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b,
       a+b*2+c*3
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 3,5,4,6,2,1
----
0
4
111
2
112
674
0
1
111
7
139
827
0
-4
111
8
143
851
0
-2
111
21
206
1241
0
-1
222
20
200
1207
0
2
222
22
211
1277
0
-1
333
1
105
635
0
2
333
4
124
738
0
2
333
5
129
760
0
2
333
10
151
905
0
2
333
12
160
966
0
4
333
13
167
1000
0
3
333
16
181
1096
0
-2
333
23
218
1297
0
1
444
6
130
793
0
-4
444
17
186
1121
0
1
444
24
223
1338
0
2
444
29
249
1484
0
-2
555
0
100
610
0
2
555
9
145
880
0
-1
555
11
158
940
0
-2
555
14
170
1030
0
1
555
15
175
1057
0
-1
555
19
198
1180
0
-1
555
25
228
1360
0
3
555
26
232
1391
0
1
555
27
236
1416

query IIIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3,
       (a+b+c+d+e)/5,
       b,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,5,7,2,4,6,1
----
555
610
102
100
102
0
4
333
635
107
105
106
1
2
111
674
112
112
113
2
-1
333
708
117
118
119
3
-3
333
738
122
124
123
4
-3
333
760
127
129
125
5
-2

query IIIIII nosort
SELECT b,
       a-b,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       c,
       c-d
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 5,3,4,6,1,2
----
105
2
1612
635
106
-2
118
-3
1757
708
119
3
129
-2
1902
760
125
-3
151
2
2281
905
150
-4
160
3
2432
966
161
-3
167
1
2501
1000
166
-3
175
4
2654
1057
176
-2
186
2
2806
1121
187
2
194
-3
2878
1158
193
3
211
2
3175
1277
214
2
218
-2
3260
1297
215
-2
223
-3
3331
1338
224
2
232
2
3473
1391
231
-2
236
3
3553
1416
235
-3
240
3
3629
1455
244
3

query IIIIII nosort
SELECT a-b,
       b,
       a+b*2+c*3+d*4+e*5,
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d
  FROM t1
 ORDER BY 5,2,1,4,3,6
----
-1
112
1680
4
111
-1
-1
139
2046
1
111
1
-1
143
2131
-4
111
1
-1
206
3114
-2
111
1
1
200
3039
-1
222
-1
2
211
3175
2
222
2
3
240
3629
-1
222
3
2
105
1612
-1
333
-2
-3
118
1757
-1
333
3
-3
124
1826
2
333
1
-2
129
1902
2
333
-3
2
151
2281
2
333
-4
3
160
2432
2
333
-3
1
167
2501
4
333
-3
1
181
2728
3
333
1
-2
218
3260
-2
333
-2
1
130
1985
1
444
1
2
186
2806
-4
444
2
-3
194
2878
-2
444
3
-3
223
3331
1
444
2
-4
249
3706
2
444
-1
4
100
1529
-2
555
1
4
145
2202
2
555
-1
1
158
2349
-1
555
-1
4
170
2579
-2
555
1
4
175
2654
1
555
-2
1
198
2949
-1
555
-1
1
228
3399
-1
555
-1
2
232
3473
3
555
-2
3
236
3553
1
555
-3

query IIII nosort
SELECT abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       a+b*2+c*3+d*4
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (e>a AND e<b)
   AND d>e
 ORDER BY 2,1,4,3
----
1
24
-1
2226
2
29
2
2476

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       a+b*2+c*3+d*4,
       a,
       a+b*2+c*3+d*4+e*5,
       c-d
  FROM t1
 WHERE d>e
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 7,3,2,4,6,1,5
----
0
10
2
1521
153
2281
-4
0
5
-2
1272
127
1902
-3
0
13
1
1676
168
2501
-3
0
12
3
1622
163
2432
-3
0
27
3
2368
239
3553
-3
0
23
-2
2165
216
3260
-2
0
1
2
1067
107
1612
-2
0
26
2
2323
234
3473
-2
0
15
4
1769
179
2654
-2
0
29
-4
2476
245
3706
-1
0
2
-1
1130
111
1680
-1
0
9
4
1472
149
2202
-1
0
4
-3
1226
121
1826
1
0
7
-1
1371
138
2046
1
0
6
1
1325
131
1985
1
0
16
1
1828
182
2728
1
0
24
-3
2226
220
3331
2
0
17
2
1861
188
2806
2
0
22
2
2125
213
3175
2
0
3
-3
1172
115
1757
3
0
18
-3
1918
191
2878
3
0
28
3
2419
243
3629
3

query IIIII nosort
SELECT d,
       (a+b+c+d+e)/5,
       d-e,
       a,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>a AND e<b)
   AND (c<=d-2 OR c>=d+2)
   AND a>b
 ORDER BY 5,2,1,4,3
----

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d-e,
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND c>d
 ORDER BY 1,2,3,4
----
4
2
1
222
6
1
1
333
7
1
1
222
8
-4
1
222
14
-2
1
444
16
3
1
333
17
-4
2
333
21
-2
1
222
22
2
2
333
24
1
2
222

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5,
       b
  FROM t1
 ORDER BY 3,1,2
----
0
102
100
1
107
105
2
112
112
3
117
118
4
122
124
5
127
129
6
132
130
7
137
139
8
142
143
9
147
145
10
152
151
11
157
158
12
162
160
13
167
167
14
172
170
15
177
175
16
182
181
17
187
186
18
192
194
19
197
198
20
202
200
21
207
206
22
212
211
23
217
218
24
222
223
25
227
228
26
232
232
27
237
236
28
242
240
29
247
249

query I nosort
SELECT a
  FROM t1
 WHERE d>e
 ORDER BY 1
----
111
121
127
131
138
149
153
163
168
179
182
213
220
234
239
245

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 1
----
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 1,3,2
----
0
1014
0
0
1067
1
0
1130
2
0
1172
3
0
1226
4
0
1272
5
0
1325
6
0
1371
7
0
1411
8
0
1472
9
0
1521
10
0
1564
11
0
1622
12
0
1676
13
0
1714
14
0
1769
15
0
1828
16
0
1861
17
0
1918
18
0
1964
19
0
2019
20
0
2069
21
0
2125
22
0
2165
23
0
2226
24
0
2264
25
0
2323
26
0
2368
27
0
2419
28
0
2476
29

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4+e*5,
       a-b
  FROM t1
 ORDER BY 3,1,2
----
29
3706
-4
3
1757
-3
4
1826
-3
18
2878
-3
24
3331
-3
5
1902
-2
23
3260
-2
2
1680
-1
7
2046
-1
8
2131
-1
21
3114
-1
6
1985
1
11
2349
1
13
2501
1
16
2728
1
19
2949
1
20
3039
1
25
3399
1
1
1612
2
10
2281
2
17
2806
2
22
3175
2
26
3473
2
12
2432
3
27
3553
3
28
3629
3
0
1529
4
9
2202
4
14
2579
4
15
2654
4

query III nosort
SELECT a+b*2,
       b-c,
       a+b*2+c*3
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 2,3,1
----
391
-4
793
544
-3
1096
635
-3
1277
304
-2
610
439
-2
880
514
-2
1030
601
-2
1207
617
-2
1241
317
-1
635
335
-1
674
483
-1
966
529
-1
1057
560
-1
1121
666
-1
1338
369
1
738
455
1
905
502
1
1000
698
1
1391
711
1
1416
416
2
827
428
2
851
743
2
1484
475
3
940
595
3
1180
652
3
1297
685
3
1360
385
4
760

query IIIIIII nosort
SELECT c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4,
       abs(b-c),
       a+b*2,
       d-e
  FROM t1
 ORDER BY 4,3,1,7,2,5,6
----
102
0
102
1014
2
304
-2
106
1
107
1067
1
317
-1
113
2
112
1130
1
335
4
119
3
117
1172
1
351
-1
123
4
122
1226
1
369
2
125
5
127
1272
4
385
2
134
6
132
1325
4
391
1
137
7
137
1371
2
416
1
141
8
142
1411
2
428
-4
147
9
147
1472
2
439
2
150
10
152
1521
1
455
2
155
11
157
1564
3
475
-1
161
12
162
1622
1
483
2
166
13
167
1676
1
502
4
172
14
172
1714
2
514
-2
176
15
177
1769
1
529
1
184
16
182
1828
3
544
3
187
17
187
1861
1
560
-4
193
18
192
1918
1
579
-2
195
19
197
1964
3
595
-1
202
20
202
2019
2
601
-1
208
21
207
2069
2
617
-2
214
22
212
2125
3
635
2
215
23
217
2165
3
652
-2
224
24
222
2226
1
666
1
225
25
227
2264
3
685
-1
231
26
232
2323
1
698
3
235
27
237
2368
1
711
1
244
28
242
2419
4
723
-1
247
29
247
2476
2
743
2

query IIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       abs(b-c),
       e
  FROM t1
 ORDER BY 2,3,1,4
----
444
104
2
103
333
107
1
109
222
111
1
110
222
115
1
117
222
121
1
120
222
127
4
126
333
131
4
132
222
138
2
135
222
142
2
144
444
149
2
146
333
153
1
152
333
159
3
157
444
163
1
162
333
168
1
165
444
174
2
173
444
179
1
177
333
182
3
180
333
188
1
189
222
191
1
192
333
199
3
197
333
201
2
204
222
205
2
209
333
213
3
210
222
216
3
219
222
220
1
221
333
229
3
227
333
234
1
230
444
239
1
237
444
243
4
242
111
245
2
246

query I nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1
----
111
111
111
111
222
222
222
333
333
333
333
333
333
333
333
333
444
444
444
444
444
555
555
555
555
555
555

query I nosort
SELECT a+b*2
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
317
335
351
369
385
391
416
428
439
455
475
483
502
514
529
544
560
579
595
601
617
635
652
666
685
698
711
723
743

query IIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       abs(a)
  FROM t1
 WHERE (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 4,3,1,2
----
192
1918
0
191
222
2226
0
220
247
2476
0
245

query IIIIII nosort
SELECT b,
       c,
       e,
       a+b*2+c*3+d*4+e*5,
       (a+b+c+d+e)/5,
       b-c
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND a>b
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 5,6,1,2,4,3
----
105
106
109
1612
107
-1

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       e
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 4,3,2,1
----
0
101
555
103
0
108
333
109
0
114
111
110
0
116
333
117
0
122
333
120
0
128
333
126

query II nosort
SELECT a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND d>e
   AND b>c
 ORDER BY 2,1
----
1226
4
1272
5

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (a+b+c+d+e)/5,
       c-d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d,
       a+b*2+c*3+d*4,
       abs(a)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 2,5,1,3,7,6,4
----
0
107
-2
1050
108
1067
107
0
117
3
1180
116
1172
115
0
127
-3
1290
128
1272
127
0
152
-4
1510
154
1521
153
0
162
-3
1600
164
1622
163
0
167
-3
1670
169
1676
168
0
177
-2
358
178
1769
179
0
187
2
376
185
1861
188
0
192
3
382
190
1918
191
0
212
2
426
212
2125
213
0
217
-2
432
217
2165
216
0
222
2
440
222
2226
220
0
232
-2
468
233
2323
234
0
237
-3
478
238
2368
239
0
242
3
486
241
2419
243

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       a-b,
       a+b*2+c*3+d*4
  FROM t1
 WHERE b>c
   AND a>b
 ORDER BY 1,3,2
----
2281
2
1521
2349
1
1564
2501
1
1676
2949
1
1964
3399
1
2264
3473
2
2323
3553
3
2368

query III nosort
SELECT b,
       d,
       b-c
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 3,1,2
----
130
133
-4
181
183
-3
211
212
-3
100
101
-2
145
148
-2
170
171
-2
200
203
-2
206
207
-2
105
108
-1
112
114
-1
118
116
-1
160
164
-1
175
178
-1
186
185
-1
223
222
-1
124
122
1
151
154
1
167
169
1
232
233
1
236
238
1
139
136
2
143
140
2
249
248
2
129
128
4

query IIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       a+b*2+c*3,
       e,
       abs(b-c),
       abs(a)
  FROM t1
 WHERE (e>a AND e<b)
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 4,3,1,5,6,2
----
222
351
708
117
1
115
222
579
1158
192
1
191
222
666
1338
221
1
220

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (e>a AND e<b)
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----

query IIIII nosort
SELECT d,
       a+b*2+c*3+d*4+e*5,
       a+b*2,
       abs(a),
       d-e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (a>b-2 AND a<b+2)
 ORDER BY 2,5,4,3,1
----
169
2501
502
168
4

query IIIIIII nosort
SELECT b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2,
       abs(b-c),
       a+b*2+c*3,
       c-d,
       a
  FROM t1
 ORDER BY 1,4,2,7,3,6,5
----
100
0
304
2
610
1
104
105
1
317
1
635
-2
107
112
2
335
1
674
-1
111
118
3
351
1
708
3
115
124
4
369
1
738
1
121
129
5
385
4
760
-3
127
130
6
391
4
793
1
131
139
7
416
2
827
1
138
143
8
428
2
851
1
142
145
9
439
2
880
-1
149
151
10
455
1
905
-4
153
158
11
475
3
940
-1
159
160
12
483
1
966
-3
163
167
13
502
1
1000
-3
168
170
14
514
2
1030
1
174
175
15
529
1
1057
-2
179
181
16
544
3
1096
1
182
186
17
560
1
1121
2
188
194
18
579
1
1158
3
191
198
19
595
3
1180
-1
199
200
20
601
2
1207
-1
201
206
21
617
2
1241
1
205
211
22
635
3
1277
2
213
218
23
652
3
1297
-2
216
223
24
666
1
1338
2
220
228
25
685
3
1360
-1
229
232
26
698
1
1391
-2
234
236
27
711
1
1416
-3
239
240
28
723
4
1455
3
243
249
29
743
2
1484
-1
245

query II nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE a>b
   AND b>c
   AND (e>c OR e<d)
 ORDER BY 2,1
----
333
2281
333
2349
333
2501
333
2949
333
3399
333
3473
444
3553

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d-e
  FROM t1
 ORDER BY 3,1,4,2
----
555
-2
0
-2
333
-1
1
-1
111
-1
2
4
333
-1
3
-1
333
1
4
2
333
4
5
2
444
-4
6
1
111
2
7
1
111
2
8
-4
555
-2
9
2
333
1
10
2
555
3
11
-1
333
-1
12
2
333
1
13
4
555
-2
14
-2
555
-1
15
1
333
-3
16
3
444
-1
17
-4
444
1
18
-2
555
3
19
-1
222
-2
20
-1
111
-2
21
-2
222
-3
22
2
333
3
23
-2
444
-1
24
1
555
3
25
-1
555
1
26
3
555
1
27
1
222
-4
28
-1
444
2
29
2

query III nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 1,2,3
----
111
-1
0
111
-1
0
111
-1
0
111
-1
0
222
1
0
222
2
0
222
3
0
333
-3
0
333
-3
0
333
-2
0
333
-2
0
333
1
0
333
1
0
333
2
0
333
2
0
333
3
0
444
-4
0
444
-3
0
444
-3
0
444
1
0
444
2
0
555
1
0
555
1
0
555
1
0
555
2
0
555
3
0
555
4
0
555
4
0
555
4
0
555
4
0

query IIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE b>c
    OR d NOT BETWEEN 110 AND 150
    OR (e>a AND e<b)
 ORDER BY 4,3,1,2
----
1529
-2
555
0
1612
-1
333
1
1757
-1
333
3
1826
2
333
4
1902
2
333
5
2046
1
111
7
2131
-4
111
8
2281
2
333
10
2349
-1
555
11
2432
2
333
12
2501
4
333
13
2579
-2
555
14
2654
1
555
15
2728
3
333
16
2806
-4
444
17
2878
-2
444
18
2949
-1
555
19
3039
-1
222
20
3114
-2
111
21
3175
2
222
22
3260
-2
333
23
3331
1
444
24
3399
-1
555
25
3473
3
555
26
3553
1
555
27
3629
-1
222
28
3706
2
444
29

query I nosort
SELECT c
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1
----
113
134
137
141
155
166
184
195
202
208
225

query IIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       a-b,
       c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR d>e
    OR b>c
 ORDER BY 4,2,1,6,5,3
----
490
111
1484
-4
247
444
382
222
1158
-3
193
444
440
222
1338
-3
224
444
1240
222
738
-3
123
333
432
222
1297
-2
215
333
1290
222
760
-2
125
333
410
222
1241
-1
208
111
1120
222
674
-1
113
111
1390
222
827
-1
137
111
1430
222
851
-1
141
111
364
333
1096
1
184
333
398
333
1180
1
195
555
402
333
1207
1
202
222
458
333
1360
1
225
555
1300
333
793
1
134
444
1580
333
940
1
155
555
1670
333
1000
1
166
333
426
333
1277
2
214
222
468
333
1391
2
231
555
1510
333
905
2
150
333
478
444
1416
3
235
555
1600
444
966
3
161
333
358
444
1057
4
176
555
1450
444
880
4
147
555

query IIIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (a+b+c+d+e)/5,
       abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c,
       a+b*2+c*3+d*4
  FROM t1
 WHERE c>d
    OR e+d BETWEEN a+b-10 AND c+130
    OR (e>a AND e<b)
 ORDER BY 2,1,4,3,5,6,7
----
3706
111
247
245
444
247
2476
1680
222
112
111
111
113
1130
1757
222
117
115
333
119
1172
1826
222
122
121
333
123
1226
1902
222
127
127
333
125
1272
2046
222
137
138
111
137
1371
2131
222
142
142
111
141
1411
2878
222
192
191
444
193
1918
3114
222
207
205
111
208
2069
3331
222
222
220
444
224
2226
1612
333
107
107
333
106
1067
1985
333
132
131
444
134
1325
2728
333
182
182
333
184
1828
2806
333
187
188
444
187
1861
3175
333
212
213
222
214
2125
1529
444
102
104
555
102
1014
2579
444
172
174
555
172
1714
3629
444
242
243
222
244
2419

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 ORDER BY 1
----
102
107
112
117
122
127
132
137
142
147
152
157
162
167
172
177
182
187
192
197
202
207
212
217
222
227
232
237
242
247

query I nosort
SELECT c-d
  FROM t1
 WHERE d>e
   AND e+d BETWEEN a+b-10 AND c+130
   AND a>b
 ORDER BY 1
----

query IIII nosort
SELECT a+b*2+c*3,
       d,
       e,
       a+b*2+c*3+d*4
  FROM t1
 WHERE d>e
   AND c BETWEEN b-2 AND d+2
   AND (a>b-2 AND a<b+2)
 ORDER BY 2,1,3,4
----
674
114
110
1130
793
133
132
1325
827
136
135
1371
1000
169
165
1676
1096
183
180
1828

query IIIIIII nosort
SELECT d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e,
       a+b*2+c*3+d*4,
       a,
       a+b*2+c*3,
       (a+b+c+d+e)/5
  FROM t1
 WHERE b>c
 ORDER BY 7,4,2,6,5,3,1
----
2
1240
120
1226
121
738
122
2
1290
126
1272
127
760
127
1
1390
135
1371
138
827
137
-4
1430
144
1411
142
851
142
2
1510
152
1521
153
905
152
-1
1580
157
1564
159
940
157
4
1670
165
1676
168
1000
167
-2
382
192
1918
191
1158
192
-1
398
197
1964
199
1180
197
-2
432
219
2165
216
1297
217
-1
458
227
2264
229
1360
227
3
468
230
2323
234
1391
232
1
478
237
2368
239
1416
237
2
490
246
2476
245
1484
247

query IIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       a,
       (a+b+c+d+e)/5,
       c,
       a+b*2
  FROM t1
 WHERE d>e
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 6,1,4,2,5,3
----
1120
-1
111
112
113
335
1240
1
121
122
123
369
1290
4
127
127
125
385
1300
-4
131
132
134
391
1390
2
138
137
137
416
1450
-2
149
147
147
439
1510
1
153
152
150
455
1600
-1
163
162
161
483
1670
1
168
167
166
502
358
-1
179
177
176
529
364
-3
182
182
184
544
426
-3
213
212
214
635
440
-1
220
222
224
666
468
1
234
232
231
698
478
1
239
237
235
711
490
2
245
247
247
743

query IIIIII nosort
SELECT a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4,
       a+b*2+c*3,
       abs(a),
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE a>b
   AND (e>a AND e<b)
 ORDER BY 6,3,1,5,2,4
----

query I nosort
SELECT c
  FROM t1
 WHERE d>e
   AND (a>b-2 AND a<b+2)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 1
----
113
134
137
166
184

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c,
       a+b*2+c*3
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1,3
----
0
106
635
0
150
905
0
155
940
0
161
966
0
166
1000
0
172
1030
0
176
1057
0
184
1096
0
187
1121
0
193
1158
0
195
1180
0
202
1207
0
208
1241
0
214
1277
0
215
1297
0
224
1338
0
225
1360
0
231
1391
0
235
1416
0
244
1455
0
247
1484

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
1
3
5

query I nosort
SELECT a-b
  FROM t1
 WHERE (e>c OR e<d)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (e>a AND e<b)
 ORDER BY 1
----
-4
-3
-3
-3
-3
-2
-2
-1
-1
-1
-1
1
1
1
1
1
1
1
2
2
2
2
2
3
3
3
4
4
4
4

query II nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c-d
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND (e>c OR e<d)
 ORDER BY 1,2
----
222
-3
222
-2
222
2
333
-4
333
-3
333
-2
333
-2
333
2
333
2
444
-3
444
-3
444
-2

query IIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
   AND a>b
   AND (e>c OR e<d)
 ORDER BY 2,5,3,4,1
----
444
-4
0
1121
2806
333
-1
0
635
1612
555
1
0
1057
2654
555
1
0
1416
3553
333
2
0
905
2281
333
2
0
966
2432
222
2
0
1277
3175
555
3
0
1391
3473
333
4
0
1000
2501

query II nosort
SELECT e,
       c-d
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR a>b
 ORDER BY 2,1
----
152
-4
126
-3
162
-3
165
-3
237
-3
109
-2
177
-2
219
-2
230
-2
110
-1
146
-1
157
-1
197
-1
204
-1
227
-1
246
-1
103
1
120
1
132
1
135
1
144
1
173
1
180
1
209
1
189
2
210
2
221
2
117
3
192
3
242
3

query IIIIII nosort
SELECT abs(b-c),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       e,
       b-c,
       c-d
  FROM t1
 WHERE (e>c OR e<d)
    OR e+d BETWEEN a+b-10 AND c+130
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 5,6,2,4,3,1
----
4
1300
6
132
-4
1
4
486
28
242
-4
3
3
364
16
180
-3
1
3
426
22
210
-3
2
2
402
20
204
-2
-1
2
1450
9
146
-2
-1
2
410
21
209
-2
1
2
1000
0
103
-2
1
2
1700
14
173
-2
1
1
1600
12
162
-1
-3
1
358
15
177
-1
-2
1
1050
1
109
-1
-2
1
1120
2
110
-1
-1
1
376
17
189
-1
2
1
440
24
221
-1
2
1
1180
3
117
-1
3
1
1510
10
152
1
-4
1
478
27
237
1
-3
1
1670
13
165
1
-3
1
468
26
230
1
-2
1
1240
4
120
1
1
1
382
18
192
1
3
2
490
29
246
2
-1
2
1390
7
135
2
1
2
1430
8
144
2
1
3
432
23
219
3
-2
3
398
19
197
3
-1
3
458
25
227
3
-1
3
1580
11
157
3
-1
4
1290
5
126
4
-3

query II nosort
SELECT abs(a),
       (a+b+c+d+e)/5
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND c BETWEEN b-2 AND d+2
   AND d>e
 ORDER BY 2,1
----
153
152
163
162
168
167
179
177
182
182
213
212
220
222
234
232
239
237
245
247

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3+d*4
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1,2,3
----
364
2728
1828
398
2949
1964
402
3039
2019
410
3114
2069
458
3399
2264
1120
1680
1130
1300
1985
1325
1390
2046
1371
1430
2131
1411
1580
2349
1564
1670
2501
1676

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b,
       a+b*2
  FROM t1
 ORDER BY 2,3,1
----
111
-4
743
222
-3
351
222
-3
369
222
-3
579
222
-3
666
222
-2
385
222
-2
652
222
-1
335
222
-1
416
222
-1
428
222
-1
617
333
1
391
333
1
475
333
1
502
333
1
544
333
1
595
333
1
601
333
1
685
333
2
317
333
2
455
333
2
560
333
2
635
333
2
698
444
3
483
444
3
711
444
3
723
444
4
304
444
4
439
444
4
514
444
4
529

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
    OR a>b
 ORDER BY 1
----
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

query IIIII nosort
SELECT c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 2,3,1,5,4
----
-1
111
113
0
1680
1
111
137
0
2046
1
111
141
0
2131
1
111
208
0
3114
-1
222
202
0
3039
-3
333
166
0
2501
1
333
184
0
2728
1
444
134
0
1985
-1
555
155
0
2349
-1
555
195
0
2949
-1
555
225
0
3399

query IIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b,
       b-c,
       a+b*2+c*3+d*4
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 1,4,3,2
----
111
-4
2
2476
222
-1
-1
1130
222
-3
1
1226
222
-1
2
1371
222
-1
2
1411
222
-1
-2
2069
222
-3
-1
2226
333
2
-1
1067
333
1
-4
1325
333
2
1
1521
333
1
1
1676
333
1
-3
1828
333
2
-1
1861
333
1
-2
2019
333
2
-3
2125
333
2
1
2323
444
4
-2
1014
444
4
-2
1472
444
3
-1
1622
444
4
-2
1714
444
4
-1
1769
444
3
1
2368

query IIIIIII nosort
SELECT d-e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4,
       a+b*2
  FROM t1
 ORDER BY 6,2,5,1,4,7,3
----
-2
1000
444
1
0
1014
304
-1
1050
333
-2
0
1067
317
4
1120
222
-1
0
1130
335
-1
1180
222
3
0
1172
351
2
1240
222
1
0
1226
369
2
1290
222
-3
0
1272
385
1
1300
333
1
0
1325
391
1
1390
222
1
0
1371
416
-4
1430
222
1
0
1411
428
2
1450
444
-1
0
1472
439
2
1510
333
-4
0
1521
455
-1
1580
333
-1
0
1564
475
2
1600
444
-3
0
1622
483
4
1670
333
-3
0
1676
502
-2
1700
444
1
0
1714
514
1
358
444
-2
0
1769
529
3
364
333
1
0
1828
544
-4
376
333
2
0
1861
560
-2
382
222
3
0
1918
579
-1
398
333
-1
0
1964
595
-1
402
333
-1
0
2019
601
-2
410
222
1
0
2069
617
2
426
333
2
0
2125
635
-2
432
222
-2
0
2165
652
1
440
222
2
0
2226
666
-1
458
333
-1
0
2264
685
3
468
333
-2
0
2323
698
1
478
444
-3
0
2368
711
-1
486
444
3
0
2419
723
2
490
111
-1
0
2476
743

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 WHERE b>c
 ORDER BY 1
----
122
127
137
142
152
157
167
192
197
217
227
232
237
247

query IIII nosort
SELECT b-c,
       a,
       a+b*2+c*3+d*4,
       d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND c>d
   AND d>e
 ORDER BY 4,2,3,1
----
-4
131
1325
133
2
138
1371
136
-3
182
1828
183

query IIIIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d-e,
       a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       a+b*2,
       abs(b-c),
       d
  FROM t1
 WHERE d>e
 ORDER BY 3,4,2,6,5,7,1
----
0
4
1680
674
335
1
114
0
2
1826
738
369
1
122
0
2
1902
760
385
4
128
0
1
1985
793
391
4
133
0
1
2046
827
416
2
136
0
2
2202
880
439
2
148
0
2
2281
905
455
1
154
0
2
2432
966
483
1
164
0
4
2501
1000
502
1
169
0
1
2654
1057
529
1
178
0
3
2728
1096
544
3
183
0
2
3175
1277
635
3
212
0
1
3331
1338
666
1
222
0
3
3473
1391
698
1
233
0
1
3553
1416
711
1
238
0
2
3706
1484
743
2
248

query IIIIII nosort
SELECT a,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (a+b+c+d+e)/5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 4,2,3,6,1,5
----
115
1180
117
3
333
116
191
382
192
18
444
190
220
440
222
24
444
222
245
490
247
29
444
248

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       e,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b-c
  FROM t1
 ORDER BY 6,4,3,1,2,5
----
1985
793
132
131
444
-4
3629
1455
242
243
222
-4
2728
1096
180
182
333
-3
3175
1277
210
213
222
-3
1529
610
103
104
555
-2
2202
880
146
149
555
-2
2579
1030
173
174
555
-2
3039
1207
204
201
222
-2
3114
1241
209
205
111
-2
1612
635
109
107
333
-1
1680
674
110
111
111
-1
1757
708
117
115
333
-1
2432
966
162
163
333
-1
2654
1057
177
179
555
-1
2806
1121
189
188
444
-1
3331
1338
221
220
444
-1
1826
738
120
121
333
1
2281
905
152
153
333
1
2501
1000
165
168
333
1
2878
1158
192
191
444
1
3473
1391
230
234
555
1
3553
1416
237
239
555
1
2046
827
135
138
111
2
2131
851
144
142
111
2
3706
1484
246
245
444
2
2349
940
157
159
555
3
2949
1180
197
199
555
3
3260
1297
219
216
333
3
3399
1360
227
229
555
3
1902
760
126
127
333
4

query III nosort
SELECT c-d,
       d,
       e
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND d NOT BETWEEN 110 AND 150
 ORDER BY 1,2,3
----
-4
154
152
-3
164
162
-3
169
165
-3
238
237
-2
108
109
-2
178
177
-2
217
219
-2
233
230
-1
156
157
-1
196
197
-1
203
204
-1
226
227
-1
248
246
1
171
173
1
183
180
1
207
209
2
185
189
2
212
210
2
222
221
3
190
192
3
241
242

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2,
       c,
       a+b*2+c*3+d*4+e*5,
       d-e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR c>d
    OR b>c
 ORDER BY 4,2,3,5,1
----
0
304
102
1529
-2
0
317
106
1612
-1
0
351
119
1757
-1
0
369
123
1826
2
0
385
125
1902
2
0
391
134
1985
1
0
416
137
2046
1
0
428
141
2131
-4
0
455
150
2281
2
0
475
155
2349
-1
0
483
161
2432
2
0
502
166
2501
4
0
514
172
2579
-2
0
529
176
2654
1
0
544
184
2728
3
0
560
187
2806
-4
0
579
193
2878
-2
0
595
195
2949
-1
0
617
208
3114
-2
0
635
214
3175
2
0
652
215
3260
-2
0
666
224
3331
1
0
685
225
3399
-1
0
698
231
3473
3
0
711
235
3553
1
0
723
244
3629
-1
0
743
247
3706
2

query IIIII nosort
SELECT b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       a+b*2+c*3+d*4+e*5,
       e
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 3,5,1,2,4
----
-1
222
114
1680
110
-4
333
133
1985
132
2
222
136
2046
135
2
222
140
2131
144
3
333
156
2349
157
1
333
169
2501
165
-3
333
183
2728
180
3
333
196
2949
197
-2
333
203
3039
204
-2
222
207
3114
209
3
333
226
3399
227

query IIII nosort
SELECT a,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       c-d,
       b
  FROM t1
 ORDER BY 4,3,2,1
----
104
0
1
100
107
0
-2
105
111
0
-1
112
115
0
3
118
121
0
1
124
127
0
-3
129
131
0
1
130
138
0
1
139
142
0
1
143
149
0
-1
145
153
0
-4
151
159
0
-1
158
163
0
-3
160
168
0
-3
167
174
0
1
170
179
0
-2
175
182
0
1
181
188
0
2
186
191
0
3
194
199
0
-1
198
201
0
-1
200
205
0
1
206
213
0
2
211
216
0
-2
218
220
0
2
223
229
0
-1
228
234
0
-2
232
239
0
-3
236
243
0
3
240
245
0
-1
249

query IIIIIII nosort
SELECT d,
       e,
       a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3,
       abs(a)
  FROM t1
 ORDER BY 1,2,7,6,4,3,5
----
101
103
304
444
0
610
104
108
109
317
333
1
635
107
114
110
335
222
2
674
111
116
117
351
222
3
708
115
122
120
369
222
4
738
121
128
126
385
222
5
760
127
133
132
391
333
6
793
131
136
135
416
222
7
827
138
140
144
428
222
8
851
142
148
146
439
444
9
880
149
154
152
455
333
10
905
153
156
157
475
333
11
940
159
164
162
483
444
12
966
163
169
165
502
333
13
1000
168
171
173
514
444
14
1030
174
178
177
529
444
15
1057
179
183
180
544
333
16
1096
182
185
189
560
333
17
1121
188
190
192
579
222
18
1158
191
196
197
595
333
19
1180
199
203
204
601
333
20
1207
201
207
209
617
222
21
1241
205
212
210
635
333
22
1277
213
217
219
652
222
23
1297
216
222
221
666
222
24
1338
220
226
227
685
333
25
1360
229
233
230
698
333
26
1391
234
238
237
711
444
27
1416
239
241
242
723
444
28
1455
243
248
246
743
111
29
1484
245

query IIII nosort
SELECT b,
       e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 2,3,1,4
----
100
103
0
0
105
109
1
0
112
110
2
0
118
117
3
0
124
120
4
0
129
126
5
0
130
132
6
0
139
135
7
0
143
144
8
0
145
146
9
0
151
152
10
0
158
157
11
0
160
162
12
0
167
165
13
0
170
173
14
0
175
177
15
0
181
180
16
0
186
189
17
0
194
192
18
0
198
197
19
0
200
204
20
0
206
209
21
0
211
210
22
0
218
219
23
0
223
221
24
0
228
227
25
0
232
230
26
0
236
237
27
0
240
242
28
0
249
246
29
0

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       a+b*2+c*3,
       a+b*2+c*3+d*4
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR c>d
 ORDER BY 3,1,2
----
1529
610
1014
1612
635
1067
1680
674
1130
1757
708
1172
1826
738
1226
1902
760
1272
1985
793
1325
2046
827
1371
2131
851
1411
2202
880
1472
2281
905
1521
2349
940
1564
2432
966
1622
2501
1000
1676
2579
1030
1714
2654
1057
1769
2728
1096
1828
2806
1121
1861
2878
1158
1918
2949
1180
1964
3039
1207
2019
3114
1241
2069
3175
1277
2125
3260
1297
2165
3331
1338
2226
3399
1360
2264
3473
1391
2323
3553
1416
2368
3629
1455
2419
3706
1484
2476

query IIII nosort
SELECT a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR b>c
 ORDER BY 3,1,2,4
----
335
2
112
1120
369
4
122
1240
385
5
127
1290
391
6
132
1300
416
7
137
1390
428
8
142
1430
455
10
152
1510
475
11
157
1580
502
13
167
1670
544
16
182
364
579
18
192
382
595
19
197
398
601
20
202
402
617
21
207
410
652
23
217
432
685
25
227
458
698
26
232
468
711
27
237
478
743
29
247
490

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4+e*5,
       a+b*2,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND a>b
 ORDER BY 3,4,2,1
----
0
1529
304
555
0
1612
317
333
0
2281
455
333
0
2349
475
555
0
2432
483
333
0
2501
502
333
0
2579
514
555
0
2654
529
555
0
2728
544
333
0
2806
560
444
0
2949
595
555
0
3039
601
222
0
3175
635
222
0
3399
685
555
0
3473
698
555
0
3553
711
555
0
3629
723
222

query III nosort
SELECT e,
       d-e,
       a+b*2+c*3
  FROM t1
 ORDER BY 2,3,1
----
144
-4
851
189
-4
1121
103
-2
610
173
-2
1030
192
-2
1158
209
-2
1241
219
-2
1297
109
-1
635
117
-1
708
157
-1
940
197
-1
1180
204
-1
1207
227
-1
1360
242
-1
1455
132
1
793
135
1
827
177
1
1057
221
1
1338
237
1
1416
120
2
738
126
2
760
146
2
880
152
2
905
162
2
966
210
2
1277
246
2
1484
180
3
1096
230
3
1391
110
4
674
165
4
1000

query IIIIIII nosort
SELECT a-b,
       e,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d,
       abs(a),
       a+b*2+c*3
  FROM t1
 WHERE (e>c OR e<d)
 ORDER BY 1,5,7,2,6,4,3
----
-4
246
245
444
-1
245
1484
-3
120
121
333
1
121
738
-3
221
220
444
2
220
1338
-2
126
127
333
-3
127
760
-2
219
216
333
-2
216
1297
-1
110
111
111
-1
111
674
-1
135
138
111
1
138
827
-1
144
142
111
1
142
851
-1
209
205
111
1
205
1241
1
165
168
333
-3
168
1000
1
157
159
555
-1
159
940
1
197
199
555
-1
199
1180
1
204
201
222
-1
201
1207
1
227
229
555
-1
229
1360
1
132
131
444
1
131
793
1
180
182
333
1
182
1096
2
152
153
333
-4
153
905
2
109
107
333
-2
107
635
2
230
234
555
-2
234
1391
2
189
188
444
2
188
1121
2
210
213
222
2
213
1277
3
162
163
333
-3
163
966
3
237
239
555
-3
239
1416
4
177
179
555
-2
179
1057
4
146
149
555
-1
149
880
4
103
104
555
1
104
610
4
173
174
555
1
174
1030

query III nosort
SELECT a+b*2+c*3,
       c-d,
       d-e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR (e>a AND e<b)
 ORDER BY 2,3,1
----
905
-4
2
1416
-3
1
760
-3
2
966
-3
2
1000
-3
4
1297
-2
-2
635
-2
-1
1057
-2
1
1391
-2
3
1484
-1
2
1121
2
-4
1338
2
1
1277
2
2
1158
3
-2
708
3
-1
1455
3
-1

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2+c*3,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4,
       e,
       d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 6,4,7,5,2,3,1
----
102
610
104
0
1014
103
101
107
635
107
1
1067
109
108
152
905
153
10
1521
152
154
157
940
159
11
1564
157
156
162
966
163
12
1622
162
164
167
1000
168
13
1676
165
169
172
1030
174
14
1714
173
171
177
1057
179
15
1769
177
178
182
1096
182
16
1828
180
183
187
1121
188
17
1861
189
185
192
1158
191
18
1918
192
190
197
1180
199
19
1964
197
196
202
1207
201
20
2019
204
203
207
1241
205
21
2069
209
207
212
1277
213
22
2125
210
212
217
1297
216
23
2165
219
217
222
1338
220
24
2226
221
222
227
1360
229
25
2264
227
226
232
1391
234
26
2323
230
233
237
1416
239
27
2368
237
238
242
1455
243
28
2419
242
241
247
1484
245
29
2476
246
248

query IIII nosort
SELECT a+b*2+c*3,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 3,4,1,2
----
635
1
105
0
708
3
118
0
760
5
129
0
905
10
151
0
966
12
160
0
1000
13
167
0
1057
15
175
0
1121
17
186
0
1158
18
194
0
1277
22
211
0
1297
23
218
0
1338
24
223
0
1391
26
232
0
1416
27
236
0
1455
28
240
0

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
1
2
3
4
5

query I nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE (e>c OR e<d)
   AND (a>b-2 AND a<b+2)
 ORDER BY 1
----
222
222
222
222
333
333
333
333
333
333
333

query I nosort
SELECT (a+b+c+d+e)/5
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR (a>b-2 AND a<b+2)
    OR d>e
 ORDER BY 1
----
102
107
112
122
127
132
137
142
147
152
157
162
167
172
177
182
187
197
202
207
212
222
227
232
237
247

query IIIII nosort
SELECT abs(b-c),
       a+b*2,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 ORDER BY 2,3,1,4,5
----
2
304
1000
444
0
1
317
1050
333
1
1
335
1120
222
2
1
351
1180
222
3
1
369
1240
222
4
4
385
1290
222
5
4
391
1300
333
6
2
416
1390
222
7
2
428
1430
222
8
2
439
1450
444
9
1
455
1510
333
10
3
475
1580
333
11
1
483
1600
444
12
1
502
1670
333
13
2
514
1700
444
14
1
529
358
444
15
3
544
364
333
16
1
560
376
333
17
1
579
382
222
18
3
595
398
333
19
2
601
402
333
20
2
617
410
222
21
3
635
426
333
22
3
652
432
222
23
1
666
440
222
24
3
685
458
333
25
1
698
468
333
26
1
711
478
444
27
4
723
486
444
28
2
743
490
111
29

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c-d,
       a+b*2+c*3+d*4
  FROM t1
 WHERE a>b
 ORDER BY 2,4,1,3
----
0
333
-2
1067
0
333
1
1325
0
333
-4
1521
0
333
-1
1564
0
333
-3
1676
0
333
1
1828
0
333
2
1861
0
333
-1
1964
0
333
-1
2019
0
333
2
2125
0
333
-1
2264
0
333
-2
2323
0
444
1
1014
0
444
-1
1472
0
444
-3
1622
0
444
1
1714
0
444
-2
1769
0
444
-3
2368
0
444
3
2419

query IIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       d,
       a-b,
       abs(b-c)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,5,3,2,4
----
111
29
248
-4
2
222
2
114
-1
1
222
3
116
-3
1
222
4
122
-3
1
222
18
190
-3
1
222
24
222
-3
1
222
7
136
-1
2
222
8
140
-1
2
222
21
207
-1
2
222
23
217
-2
3
222
5
128
-2
4
333
1
108
2
1
333
10
154
2
1
333
13
169
1
1
333
17
185
2
1
333
26
233
2
1
333
20
203
1
2
333
11
156
1
3
333
16
183
1
3
333
19
196
1
3
333
22
212
2
3
333
25
226
1
3
333
6
133
1
4
444
12
164
3
1
444
15
178
4
1
444
27
238
3
1
444
0
101
4
2
444
9
148
4
2
444
14
171
4
2
444
28
241
3
4

query IIIIII nosort
SELECT a+b*2+c*3+d*4,
       a,
       a+b*2,
       a-b,
       abs(a),
       a+b*2+c*3
  FROM t1
 ORDER BY 2,3,1,6,4,5
----
1014
104
304
4
104
610
1067
107
317
2
107
635
1130
111
335
-1
111
674
1172
115
351
-3
115
708
1226
121
369
-3
121
738
1272
127
385
-2
127
760
1325
131
391
1
131
793
1371
138
416
-1
138
827
1411
142
428
-1
142
851
1472
149
439
4
149
880
1521
153
455
2
153
905
1564
159
475
1
159
940
1622
163
483
3
163
966
1676
168
502
1
168
1000
1714
174
514
4
174
1030
1769
179
529
4
179
1057
1828
182
544
1
182
1096
1861
188
560
2
188
1121
1918
191
579
-3
191
1158
1964
199
595
1
199
1180
2019
201
601
1
201
1207
2069
205
617
-1
205
1241
2125
213
635
2
213
1277
2165
216
652
-2
216
1297
2226
220
666
-3
220
1338
2264
229
685
1
229
1360
2323
234
698
2
234
1391
2368
239
711
3
239
1416
2419
243
723
3
243
1455
2476
245
743
-4
245
1484

query IIIIIII nosort
SELECT d-e,
       c,
       a+b*2+c*3,
       b,
       abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE (e>c OR e<d)
   AND d>e
   AND c>d
 ORDER BY 3,5,1,2,4,6,7
----
2
123
738
124
121
222
1826
1
134
793
130
131
333
1985
1
137
827
139
138
222
2046
3
184
1096
181
182
333
2728
2
214
1277
211
213
333
3175
1
224
1338
223
220
222
3331

query IIIIII nosort
SELECT d-e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c,
       a+b*2+c*3,
       b,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE b>c
 ORDER BY 1,4,6,3,5,2
----
-4
222
141
851
143
2131
-2
222
193
1158
194
2878
-2
222
215
1297
218
3260
-1
333
155
940
158
2349
-1
333
195
1180
198
2949
-1
333
225
1360
228
3399
1
222
137
827
139
2046
1
444
235
1416
236
3553
2
222
123
738
124
1826
2
222
125
760
129
1902
2
333
150
905
151
2281
2
111
247
1484
249
3706
3
333
231
1391
232
3473
4
333
166
1000
167
2501

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a-b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE d>e
 ORDER BY 1,6,2,5,4,3
----
112
-1
0
-1
111
2
122
1
0
-3
333
4
127
-3
0
-2
333
5
132
1
0
1
444
6
137
1
0
-1
111
7
147
-1
0
4
555
9
152
-4
0
2
333
10
162
-3
0
3
333
12
167
-3
0
1
333
13
177
-2
0
4
555
15
182
1
0
1
333
16
212
2
0
2
222
22
222
2
0
-3
444
24
232
-2
0
2
555
26
237
-3
0
3
555
27
247
-1
0
-4
444
29

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 1
----
3
18
24
29

query IIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 2,4,3,1
----
1050
1
1067
0
1120
2
1130
0
1180
3
1172
0
1240
4
1226
0
1290
5
1272
0
1300
6
1325
0
1390
7
1371
0
1430
8
1411
0
1450
9
1472
0
1510
10
1521
0
1580
11
1564
0
1600
12
1622
0
1670
13
1676
0
1700
14
1714
0
358
15
1769
0
364
16
1828
0
376
17
1861
0
382
18
1918
0
398
19
1964
0
402
20
2019
0
410
21
2069
0
426
22
2125
0
432
23
2165
0
440
24
2226
0
458
25
2264
0
468
26
2323
0
478
27
2368
0
486
28
2419
0
490
29
2476
0

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c>d
 ORDER BY 2,1
----
364
0
376
0
382
0
410
0
426
0
440
0
486
0
1000
0
1180
0
1240
0
1300
0
1390
0
1430
0
1700
0

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       abs(b-c),
       a+b*2+c*3+d*4,
       d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d-e,
       abs(a)
  FROM t1
 WHERE a>b
    OR b>c
    OR c>d
 ORDER BY 1,4,5,2,6,7,3
----
102
2
1014
101
444
-2
104
107
1
1067
108
333
-1
107
117
1
1172
116
222
-1
115
122
1
1226
122
222
2
121
127
4
1272
128
222
2
127
132
4
1325
133
333
1
131
137
2
1371
136
222
1
138
142
2
1411
140
222
-4
142
147
2
1472
148
444
2
149
152
1
1521
154
333
2
153
157
3
1564
156
333
-1
159
162
1
1622
164
444
2
163
167
1
1676
169
333
4
168
172
2
1714
171
444
-2
174
177
1
1769
178
444
1
179
182
3
1828
183
333
3
182
187
1
1861
185
333
-4
188
192
1
1918
190
222
-2
191
197
3
1964
196
333
-1
199
202
2
2019
203
333
-1
201
207
2
2069
207
222
-2
205
212
3
2125
212
333
2
213
217
3
2165
217
222
-2
216
222
1
2226
222
222
1
220
227
3
2264
226
333
-1
229
232
1
2323
233
333
3
234
237
1
2368
238
444
1
239
242
4
2419
241
444
-1
243
247
2
2476
248
111
2
245

query IIIIII nosort
SELECT abs(a),
       c,
       a+b*2,
       a+b*2+c*3+d*4,
       d,
       a
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 5,3,4,1,6,2
----
107
106
317
1067
108
107
111
113
335
1130
114
111
115
119
351
1172
116
115
121
123
369
1226
122
121
127
125
385
1272
128
127
131
134
391
1325
133
131
138
137
416
1371
136
138
142
141
428
1411
140
142
149
147
439
1472
148
149
153
150
455
1521
154
153
159
155
475
1564
156
159
163
161
483
1622
164
163
168
166
502
1676
169
168
174
172
514
1714
171
174
179
176
529
1769
178
179
182
184
544
1828
183
182
188
187
560
1861
185
188
191
193
579
1918
190
191
199
195
595
1964
196
199
201
202
601
2019
203
201
205
208
617
2069
207
205
213
214
635
2125
212
213
216
215
652
2165
217
216
220
224
666
2226
222
220
229
225
685
2264
226
229
234
231
698
2323
233
234
239
235
711
2368
238
239
243
244
723
2419
241
243
245
247
743
2476
248
245

query II nosort
SELECT b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>a AND e<b)
   AND c BETWEEN b-2 AND d+2
   AND d>e
 ORDER BY 1,2
----
-1
440
2
490

query III nosort
SELECT a-b,
       c-d,
       b
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 3,1,2
----
-3
3
118
-3
3
194
-3
2
223
-4
-1
249

query IIIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 6,1,2,3,7,4,5
----
358
529
444
15
4
0
175
364
544
333
16
1
0
181
376
560
333
17
2
0
186
402
601
333
20
1
0
200
410
617
222
21
-1
0
206
426
635
333
22
2
0
211
440
666
222
24
-3
0
223
468
698
333
26
2
0
232
478
711
444
27
3
0
236
490
743
111
29
-4
0
249
1000
304
444
0
4
0
100
1050
317
333
1
2
0
105
1120
335
222
2
-1
0
112
1240
369
222
4
-3
0
124
1300
391
333
6
1
0
130
1390
416
222
7
-1
0
139
1430
428
222
8
-1
0
143
1450
439
444
9
4
0
145
1510
455
333
10
2
0
151
1600
483
444
12
3
0
160
1670
502
333
13
1
0
167
1700
514
444
14
4
0
170

query III nosort
SELECT c-d,
       a-b,
       b
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 3,1,2
----
1
4
100
-2
2
105
-1
-1
112
1
-3
124
1
1
130
1
-1
139
1
-1
143
-1
4
145
-4
2
151
-3
3
160
-3
1
167
1
4
170
-2
4
175
1
1
181
2
2
186
-1
1
200
1
-1
206
2
2
211
2
-3
223
-2
2
232
-3
3
236
-1
-4
249

query IIIII nosort
SELECT b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e,
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 3,4,2,5,1
----
-1
1120
110
112
1130
-4
1300
132
132
1325
2
1390
135
137
1371
2
1430
144
142
1411
1
1670
165
167
1676
-3
364
180
182
1828
-2
402
204
202
2019
-2
410
209
207
2069

query II nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e
  FROM t1
 WHERE d>e
   AND (a>b-2 AND a<b+2)
 ORDER BY 2,1
----
111
1
444
1
333
3
111
4
333
4

query IIIIIII nosort
SELECT e,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a),
       c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       b,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 6,7,5,4,1,3,2
----
103
444
104
1
555
100
102
109
333
107
-2
333
105
107
110
222
111
-1
111
112
112
117
222
115
3
333
118
117
120
222
121
1
333
124
122
126
222
127
-3
333
129
127
132
333
131
1
444
130
132
135
222
138
1
111
139
137
144
222
142
1
111
143
142
146
444
149
-1
555
145
147
152
333
153
-4
333
151
152
157
333
159
-1
555
158
157
162
444
163
-3
333
160
162
165
333
168
-3
333
167
167
173
444
174
1
555
170
172
177
444
179
-2
555
175
177
180
333
182
1
333
181
182
189
333
188
2
444
186
187
192
222
191
3
444
194
192
197
333
199
-1
555
198
197
204
333
201
-1
222
200
202
209
222
205
1
111
206
207
210
333
213
2
222
211
212
219
222
216
-2
333
218
217
221
222
220
2
444
223
222
227
333
229
-1
555
228
227
230
333
234
-2
555
232
232
237
444
239
-3
555
236
237
242
444
243
3
222
240
242
246
111
245
-1
444
249
247

query I nosort
SELECT d-e
  FROM t1
 ORDER BY 1
----
-4
-4
-2
-2
-2
-2
-2
-1
-1
-1
-1
-1
-1
-1
1
1
1
1
1
2
2
2
2
2
2
2
3
3
4
4

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (e>a AND e<b)
   AND (a>b-2 AND a<b+2)
 ORDER BY 1
----

query II nosort
SELECT a+b*2,
       e
  FROM t1
 ORDER BY 2,1
----
304
103
317
109
335
110
351
117
369
120
385
126
391
132
416
135
428
144
439
146
455
152
475
157
483
162
502
165
514
173
529
177
544
180
560
189
579
192
595
197
601
204
617
209
635
210
652
219
666
221
685
227
698
230
711
237
723
242
743
246

query IIIII nosort
SELECT (a+b+c+d+e)/5,
       a,
       b-c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE c>d
   AND (e>c OR e<d)
 ORDER BY 3,1,2,5,4
----
132
131
-4
6
333
182
182
-3
16
333
212
213
-3
22
333
102
104
-2
0
444
172
174
-2
14
444
207
205
-2
21
222
187
188
-1
17
333
222
220
-1
24
222
122
121
1
4
222
137
138
2
7
222
142
142
2
8
222

query IIIIIII nosort
SELECT a+b*2+c*3+d*4,
       a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(a),
       d,
       b-c
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (e>a AND e<b)
   AND c>d
 ORDER BY 1,5,4,6,3,2,7
----
1918
1158
382
222
191
190
1
2226
1338
440
222
220
222
-1

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       a+b*2,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b-c,
       d-e,
       b
  FROM t1
 ORDER BY 6,1,4,3,5,2
----
102
304
1000
-2
-2
100
107
317
1050
-1
-1
105
112
335
1120
-1
4
112
117
351
1180
-1
-1
118
122
369
1240
1
2
124
127
385
1290
4
2
129
132
391
1300
-4
1
130
137
416
1390
2
1
139
142
428
1430
2
-4
143
147
439
1450
-2
2
145
152
455
1510
1
2
151
157
475
1580
3
-1
158
162
483
1600
-1
2
160
167
502
1670
1
4
167
172
514
1700
-2
-2
170
177
529
358
-1
1
175
182
544
364
-3
3
181
187
560
376
-1
-4
186
192
579
382
1
-2
194
197
595
398
3
-1
198
202
601
402
-2
-1
200
207
617
410
-2
-2
206
212
635
426
-3
2
211
217
652
432
3
-2
218
222
666
440
-1
1
223
227
685
458
3
-1
228
232
698
468
1
3
232
237
711
478
1
1
236
242
723
486
-4
-1
240
247
743
490
2
2
249

query IIIIII nosort
SELECT d,
       c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a,
       c-d,
       a-b
  FROM t1
 ORDER BY 6,4,3,2,5,1
----
248
247
490
245
-1
-4
116
119
1180
115
3
-3
122
123
1240
121
1
-3
190
193
382
191
3
-3
222
224
440
220
2
-3
128
125
1290
127
-3
-2
217
215
432
216
-2
-2
114
113
1120
111
-1
-1
136
137
1390
138
1
-1
140
141
1430
142
1
-1
207
208
410
205
1
-1
133
134
1300
131
1
1
156
155
1580
159
-1
1
169
166
1670
168
-3
1
183
184
364
182
1
1
196
195
398
199
-1
1
203
202
402
201
-1
1
226
225
458
229
-1
1
108
106
1050
107
-2
2
154
150
1510
153
-4
2
185
187
376
188
2
2
212
214
426
213
2
2
233
231
468
234
-2
2
164
161
1600
163
-3
3
238
235
478
239
-3
3
241
244
486
243
3
3
101
102
1000
104
1
4
148
147
1450
149
-1
4
171
172
1700
174
1
4
178
176
358
179
-2
4

query IIII nosort
SELECT a,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       abs(b-c),
       a+b*2+c*3
  FROM t1
 WHERE b>c
    OR (e>c OR e<d)
 ORDER BY 2,1,3,4
----
245
111
2
1484
111
222
1
674
121
222
1
738
127
222
4
760
138
222
2
827
142
222
2
851
191
222
1
1158
205
222
2
1241
216
222
3
1297
220
222
1
1338
107
333
1
635
131
333
4
793
153
333
1
905
159
333
3
940
168
333
1
1000
182
333
3
1096
188
333
1
1121
199
333
3
1180
201
333
2
1207
213
333
3
1277
229
333
3
1360
234
333
1
1391
104
444
2
610
149
444
2
880
163
444
1
966
174
444
2
1030
179
444
1
1057
239
444
1
1416

query II nosort
SELECT a+b*2,
       (a+b+c+d+e)/5
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 1,2
----
335
112
391
132
416
137
428
142
475
157
502
167
544
182
595
197
601
202
617
207
685
227

query III nosort
SELECT abs(b-c),
       a-b,
       a+b*2
  FROM t1
 WHERE (e>c OR e<d)
    OR d>e
 ORDER BY 3,2,1
----
2
4
304
1
2
317
1
-1
335
1
-3
369
4
-2
385
4
1
391
2
-1
416
2
-1
428
2
4
439
1
2
455
3
1
475
1
3
483
1
1
502
2
4
514
1
4
529
3
1
544
1
2
560
3
1
595
2
1
601
2
-1
617
3
2
635
3
-2
652
1
-3
666
3
1
685
1
2
698
1
3
711
2
-4
743

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2+c*3,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 ORDER BY 3,5,1,4,2,6
----
1529
444
610
555
1
0
1612
333
635
333
-2
0
1680
222
674
111
-1
0
1757
222
708
333
3
0
1826
222
738
333
1
0
1902
222
760
333
-3
0
1985
333
793
444
1
0
2046
222
827
111
1
0
2131
222
851
111
1
0
2202
444
880
555
-1
0
2281
333
905
333
-4
0
2349
333
940
555
-1
0
2432
444
966
333
-3
0
2501
333
1000
333
-3
0
2579
444
1030
555
1
0
2654
444
1057
555
-2
0
2728
333
1096
333
1
0
2806
333
1121
444
2
0
2878
222
1158
444
3
0
2949
333
1180
555
-1
0
3039
333
1207
222
-1
0
3114
222
1241
111
1
0
3175
333
1277
222
2
0
3260
222
1297
333
-2
0
3331
222
1338
444
2
0
3399
333
1360
555
-1
0
3473
333
1391
555
-2
0
3553
444
1416
555
-3
0
3629
444
1455
222
3
0
3706
111
1484
444
-1
0

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(a)
  FROM t1
 ORDER BY 1,2
----
0
104
1
107
2
111
3
115
4
121
5
127
6
131
7
138
8
142
9
149
10
153
11
159
12
163
13
168
14
174
15
179
16
182
17
188
18
191
19
199
20
201
21
205
22
213
23
216
24
220
25
229
26
234
27
239
28
243
29
245

query IIIII nosort
SELECT c,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5,
       a+b*2+c*3+d*4,
       a+b*2+c*3
  FROM t1
 WHERE d>e
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 4,5,3,1,2
----
113
2
112
1130
674
123
4
122
1226
738
134
6
132
1325
793
137
7
137
1371
827
147
9
147
1472
880
150
10
152
1521
905
161
12
162
1622
966
166
13
167
1676
1000
176
15
177
1769
1057
184
16
182
1828
1096
214
22
212
2125
1277
224
24
222
2226
1338
231
26
232
2323
1391
235
27
237
2368
1416
247
29
247
2476
1484

query III nosort
SELECT a-b,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE a>b
   AND (e>a AND e<b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 1,2,3
----

query IIIIIII nosort
SELECT e,
       (a+b+c+d+e)/5,
       a+b*2,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 6,7,3,4,5,2,1
----
110
112
335
111
111
1
2
165
167
502
168
333
1
13
135
137
416
138
111
2
7
144
142
428
142
111
2
8
204
202
601
201
222
2
20
209
207
617
205
111
2
21
157
157
475
159
555
3
11
180
182
544
182
333
3
16
197
197
595
199
555
3
19
227
227
685
229
555
3
25
132
132
391
131
444
4
6

query IIII nosort
SELECT a+b*2+c*3+d*4,
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c
  FROM t1
 WHERE c>d
 ORDER BY 1,3,4,2
----
1014
1
444
102
1172
3
222
119
1226
1
222
123
1325
1
333
134
1371
1
222
137
1411
1
222
141
1714
1
444
172
1828
1
333
184
1861
2
333
187
1918
3
222
193
2069
1
222
208
2125
2
333
214
2226
2
222
224
2419
3
444
244

query IIIIII nosort
SELECT b,
       abs(b-c),
       d,
       a-b,
       d-e,
       c
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 2,5,1,4,6,3
----
186
1
185
2
-4
187
105
1
108
2
-1
106
175
1
178
4
1
176
223
1
222
-3
1
224
236
1
238
3
1
235
124
1
122
-3
2
123
151
1
154
2
2
150
160
1
164
3
2
161
232
1
233
2
3
231
112
1
114
-1
4
113
167
1
169
1
4
166
143
2
140
-1
-4
141
100
2
101
4
-2
102
170
2
171
4
-2
172
206
2
207
-1
-2
208
200
2
203
1
-1
202
139
2
136
-1
1
137
145
2
148
4
2
147
249
2
248
-4
2
247
211
3
212
2
2
214
181
3
183
1
3
184
130
4
133
1
1
134

query IIII nosort
SELECT b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a,
       d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
 ORDER BY 4,2,3,1
----
-1
1120
111
114
-4
1300
131
133
2
1390
138
136
2
1430
142
140
3
1580
159
156
1
1670
168
169
-3
364
182
183
3
398
199
196
-2
402
201
203
-2
410
205
207
3
458
229
226

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----
1014
1067
1130
1172
1226
1272

query II nosort
SELECT a-b,
       a+b*2
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR (c<=d-2 OR c>=d+2)
    OR a>b
 ORDER BY 1,2
----
-4
743
-3
351
-3
579
-3
666
-2
385
-2
652
-1
617
1
391
1
475
1
502
1
544
1
595
1
601
1
685
2
317
2
455
2
560
2
635
2
698
3
483
3
711
3
723
4
304
4
439
4
514
4
529

query IIIIIII nosort
SELECT a,
       b,
       abs(b-c),
       e,
       a+b*2,
       d-e,
       (a+b+c+d+e)/5
  FROM t1
 WHERE b>c
   AND c>d
 ORDER BY 6,1,7,2,5,4,3
----
142
143
2
144
428
-4
142
191
194
1
192
579
-2
192
138
139
2
135
416
1
137
121
124
1
120
369
2
122

query IIIIIII nosort
SELECT b,
       a-b,
       e,
       d,
       abs(a),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d>e
 ORDER BY 2,1,5,3,6,4,7
----
249
-4
246
248
245
29
0
124
-3
120
122
121
4
0
223
-3
221
222
220
24
0
112
-1
110
114
111
2
0
139
-1
135
136
138
7
0
130
1
132
133
131
6
0
167
1
165
169
168
13
0
181
1
180
183
182
16
0
151
2
152
154
153
10
0
211
2
210
212
213
22
0
232
2
230
233
234
26
0
160
3
162
164
163
12
0
236
3
237
238
239
27
0
145
4
146
148
149
9
0
175
4
177
178
179
15
0

query II nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
 ORDER BY 2,1
----
333
-4
333
-3
333
-3
333
-3
555
-3
333
-2
333
-2
555
-2
555
-2
222
2
444
2
444
2
222
3
333
3
444
3

query IIIIIII nosort
SELECT abs(b-c),
       e,
       a-b,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a,
       b
  FROM t1
 WHERE b>c
    OR c>d
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 6,5,7,2,3,1,4
----
2
103
4
-2
0
104
100
1
109
2
-1
1
107
105
1
110
-1
4
2
111
112
1
117
-3
-1
3
115
118
1
120
-3
2
4
121
124
4
126
-2
2
5
127
129
4
132
1
1
6
131
130
2
135
-1
1
7
138
139
2
144
-1
-4
8
142
143
1
152
2
2
10
153
151
3
157
1
-1
11
159
158
1
165
1
4
13
168
167
2
173
4
-2
14
174
170
3
180
1
3
16
182
181
1
189
2
-4
17
188
186
1
192
-3
-2
18
191
194
3
197
1
-1
19
199
198
2
209
-1
-2
21
205
206
3
210
2
2
22
213
211
3
219
-2
-2
23
216
218
1
221
-3
1
24
220
223
3
227
1
-1
25
229
228
1
230
2
3
26
234
232
1
237
3
1
27
239
236
4
242
3
-1
28
243
240
2
246
-4
2
29
245
249

query IIIII nosort
SELECT c-d,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d,
       a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND b>c
   AND c>d
 ORDER BY 3,4,1,2,5
----
1
333
122
738
1240
1
111
136
827
1390
1
111
140
851
1430
3
444
190
1158
382

query IIIII nosort
SELECT b,
       a-b,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND c>d
 ORDER BY 1,2,3,5,4
----
100
4
1529
0
101
170
4
2579
0
171
181
1
2728
0
183
186
2
2806
0
185
194
-3
2878
0
190
206
-1
3114
0
207
211
2
3175
0
212
223
-3
3331
0
222
240
3
3629
0
241

query IIIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b,
       a+b*2+c*3,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 4,3,5,2,7,1,6
----
1000
0
100
610
4
0
1014
1050
1
105
635
2
0
1067
1120
2
112
674
-1
0
1130
1180
3
118
708
-3
0
1172
1240
4
124
738
-3
0
1226
1290
5
129
760
-2
0
1272
1300
6
130
793
1
0
1325
1390
7
139
827
-1
0
1371
1430
8
143
851
-1
0
1411
1450
9
145
880
4
0
1472
1510
10
151
905
2
0
1521
1580
11
158
940
1
0
1564
1600
12
160
966
3
0
1622
1670
13
167
1000
1
0
1676
1700
14
170
1030
4
0
1714
358
15
175
1057
4
0
1769
364
16
181
1096
1
0
1828
376
17
186
1121
2
0
1861
382
18
194
1158
-3
0
1918
398
19
198
1180
1
0
1964
402
20
200
1207
1
0
2019
410
21
206
1241
-1
0
2069
426
22
211
1277
2
0
2125
432
23
218
1297
-2
0
2165
440
24
223
1338
-3
0
2226
458
25
228
1360
1
0
2264
468
26
232
1391
2
0
2323
478
27
236
1416
3
0
2368
486
28
240
1455
3
0
2419
490
29
249
1484
-4
0
2476

query IIIIIII nosort
SELECT d-e,
       b,
       abs(b-c),
       c,
       a+b*2+c*3,
       a+b*2+c*3+d*4,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 4,6,7,2,5,3,1
----
-2
100
2
102
610
1014
1529
-1
105
1
106
635
1067
1612
4
112
1
113
674
1130
1680
-1
118
1
119
708
1172
1757
2
124
1
123
738
1226
1826
2
129
4
125
760
1272
1902

query IIIII nosort
SELECT a+b*2,
       c,
       abs(a),
       b,
       d-e
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR c>d
 ORDER BY 5,2,3,1,4
----
428
141
142
143
-4
560
187
188
186
-4
304
102
104
100
-2
514
172
174
170
-2
579
193
191
194
-2
617
208
205
206
-2
351
119
115
118
-1
475
155
159
158
-1
595
195
199
198
-1
601
202
201
200
-1
685
225
229
228
-1
723
244
243
240
-1
391
134
131
130
1
416
137
138
139
1
666
224
220
223
1
369
123
121
124
2
635
214
213
211
2
544
184
182
181
3
335
113
111
112
4
502
166
168
167
4

query I nosort
SELECT a+b*2
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND b>c
 ORDER BY 1
----
416
428
475
502
595
685

query IIII nosort
SELECT abs(b-c),
       d-e,
       a+b*2,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR d NOT BETWEEN 110 AND 150
    OR c>d
 ORDER BY 4,2,3,1
----
2
-4
428
111
2
-2
617
111
2
1
416
111
2
-1
601
222
4
-1
723
222
3
2
635
222
3
-2
652
333
1
-1
317
333
1
-1
351
333
1
2
369
333
4
2
385
333
1
2
455
333
1
2
483
333
3
3
544
333
1
4
502
333
1
-4
560
444
1
-2
579
444
4
1
391
444
1
1
666
444
2
2
743
444
2
-2
304
555
2
-2
514
555
3
-1
475
555
3
-1
595
555
3
-1
685
555
1
1
529
555
1
1
711
555
1
3
698
555

query IIII nosort
SELECT b-c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 1,2,3,4
----
-1
222
116
1180
-1
222
222
440
1
222
190
382
2
111
248
490

query III nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 2,3,1
----
15
358
176
17
376
187
18
382
193
22
426
214
23
432
215
24
440
224
26
468
231
27
478
235
28
486
244
1
1050
106
3
1180
119
5
1290
125
10
1510
150
12
1600
161
13
1670
166

query II nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 1,2
----
0
1014
1
1067
2
1130
3
1172
4
1226
5
1272
6
1325
7
1371
8
1411
9
1472
10
1521
11
1564
12
1622
13
1676
14
1714
15
1769
16
1828
17
1861
18
1918
19
1964
20
2019
21
2069
22
2125
23
2165
24
2226
25
2264
26
2323
27
2368
28
2419
29
2476

query IIIIII nosort
SELECT a+b*2+c*3,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d-e,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a
  FROM t1
 ORDER BY 6,4,5,3,2,1
----
610
555
1000
-2
0
104
635
333
1050
-1
0
107
674
111
1120
4
0
111
708
333
1180
-1
0
115
738
333
1240
2
0
121
760
333
1290
2
0
127
793
444
1300
1
0
131
827
111
1390
1
0
138
851
111
1430
-4
0
142
880
555
1450
2
0
149
905
333
1510
2
0
153
940
555
1580
-1
0
159
966
333
1600
2
0
163
1000
333
1670
4
0
168
1030
555
1700
-2
0
174
1057
555
358
1
0
179
1096
333
364
3
0
182
1121
444
376
-4
0
188
1158
444
382
-2
0
191
1180
555
398
-1
0
199
1207
222
402
-1
0
201
1241
111
410
-2
0
205
1277
222
426
2
0
213
1297
333
432
-2
0
216
1338
444
440
1
0
220
1360
555
458
-1
0
229
1391
555
468
3
0
234
1416
555
478
1
0
239
1455
222
486
-1
0
243
1484
444
490
2
0
245

query III nosort
SELECT d-e,
       a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 2,1,3
----
-1
-3
222
2
-3
222
2
-2
222
4
-1
222
-1
2
333
-2
4
444

query III nosort
SELECT a+b*2+c*3,
       e,
       d-e
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND c BETWEEN b-2 AND d+2
   AND d>e
 ORDER BY 3,2,1
----
1057
177
1
1338
221
1
1416
237
1
905
152
2
966
162
2
1277
210
2
1484
246
2
1096
180
3
1391
230
3
1000
165
4

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d,
       e
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 2,3,1
----
490
-1
246
440
2
221
1180
3
117
382
3
192

query II nosort
SELECT a+b*2+c*3,
       (a+b+c+d+e)/5
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
   AND (e>c OR e<d)
 ORDER BY 2,1
----
635
107
905
152
940
157
966
162
1000
167
1030
172
1057
177
1096
182
1121
187
1180
197
1207
202
1241
207
1277
212
1297
217
1338
222
1360
227
1391
232
1416
237
1484
247

query IIIIII nosort
SELECT a,
       a+b*2+c*3,
       abs(a),
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE (e>a AND e<b)
   AND e+d BETWEEN a+b-10 AND c+130
   AND (e>c OR e<d)
 ORDER BY 4,2,5,1,3,6
----

query IIIIII nosort
SELECT a-b,
       (a+b+c+d+e)/5,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e,
       a,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 1,5,3,6,4,2
----
-4
247
444
2
245
490
-3
117
333
-1
115
1180
-3
122
333
2
121
1240
-3
192
444
-2
191
382
-3
222
444
1
220
440
-2
127
333
2
127
1290
-2
217
333
-2
216
432
-1
112
111
4
111
1120
-1
137
111
1
138
1390
-1
142
111
-4
142
1430
-1
207
111
-2
205
410
1
132
444
1
131
1300
1
157
555
-1
159
1580
1
167
333
4
168
1670
1
182
333
3
182
364
1
197
555
-1
199
398
1
202
222
-1
201
402
1
227
555
-1
229
458
2
107
333
-1
107
1050
2
152
333
2
153
1510
2
187
444
-4
188
376
2
212
222
2
213
426
2
232
555
3
234
468
3
162
333
2
163
1600
3
237
555
1
239
478
3
242
222
-1
243
486
4
102
555
-2
104
1000
4
147
555
2
149
1450
4
172
555
-2
174
1700
4
177
555
1
179
358

query IIII nosort
SELECT a+b*2,
       d,
       abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE b>c
    OR (c<=d-2 OR c>=d+2)
    OR (e>c OR e<d)
 ORDER BY 2,3,1,4
----
304
101
104
555
317
108
107
333
335
114
111
111
351
116
115
333
369
122
121
333
385
128
127
333
391
133
131
444
416
136
138
111
428
140
142
111
439
148
149
555
455
154
153
333
475
156
159
555
483
164
163
333
502
169
168
333
514
171
174
555
529
178
179
555
544
183
182
333
560
185
188
444
579
190
191
444
595
196
199
555
601
203
201
222
617
207
205
111
635
212
213
222
652
217
216
333
666
222
220
444
685
226
229
555
698
233
234
555
711
238
239
555
723
241
243
222
743
248
245
444

query IIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3+d*4+e*5,
       abs(b-c),
       (a+b+c+d+e)/5
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 4,3,2,1
----
3
1757
1
117
18
2878
1
192
24
3331
1
222
29
3706
2
247

query III nosort
SELECT a-b,
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 3,1,2
----
-4
-1
111
-3
1
222
-3
2
222
-3
3
222
-3
3
222
-2
-3
222
-2
-2
222
-1
-1
222
-1
1
222
-1
1
222
-1
1
222
1
-3
333
1
-1
333
1
-1
333
1
-1
333
1
-1
333
1
1
333
1
1
333
2
-4
333
2
-2
333
2
-2
333
2
2
333
2
2
333
3
-3
444
3
-3
444
3
3
444
4
-2
444
4
-1
444
4
1
444
4
1
444

query III nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c),
       abs(a)
  FROM t1
 WHERE (e>c OR e<d)
   AND d>e
   AND c BETWEEN b-2 AND d+2
 ORDER BY 3,1,2
----
1120
1
111
1240
1
121
1300
4
131
1390
2
138
1450
2
149
1510
1
153
1600
1
163
1670
1
168
358
1
179
364
3
182
426
3
213
440
1
220
468
1
234
478
1
239
490
2
245

query IIIII nosort
SELECT c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE b>c
   AND a>b
 ORDER BY 3,4,2,5,1
----
195
398
-1
555
333
225
458
-1
555
333
155
1580
-1
555
333
235
478
1
555
444
150
1510
2
333
333
231
468
3
555
333
166
1670
4
333
333

query I nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 WHERE a>b
   AND c>d
   AND d>e
 ORDER BY 1
----
364
426
1300

query II nosort
SELECT d,
       c
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND d>e
 ORDER BY 1,2
----
114
113
122
123
133
134
136
137
148
147
154
150
164
161
169
166
178
176
183
184
212
214
222
224
233
231
238
235
248
247

query IIIIII nosort
SELECT a,
       c-d,
       c,
       (a+b+c+d+e)/5,
       abs(b-c),
       b
  FROM t1
 ORDER BY 1,2,5,4,6,3
----
104
1
102
102
2
100
107
-2
106
107
1
105
111
-1
113
112
1
112
115
3
119
117
1
118
121
1
123
122
1
124
127
-3
125
127
4
129
131
1
134
132
4
130
138
1
137
137
2
139
142
1
141
142
2
143
149
-1
147
147
2
145
153
-4
150
152
1
151
159
-1
155
157
3
158
163
-3
161
162
1
160
168
-3
166
167
1
167
174
1
172
172
2
170
179
-2
176
177
1
175
182
1
184
182
3
181
188
2
187
187
1
186
191
3
193
192
1
194
199
-1
195
197
3
198
201
-1
202
202
2
200
205
1
208
207
2
206
213
2
214
212
3
211
216
-2
215
217
3
218
220
2
224
222
1
223
229
-1
225
227
3
228
234
-2
231
232
1
232
239
-3
235
237
1
236
243
3
244
242
4
240
245
-1
247
247
2
249

query IIIII nosort
SELECT a+b*2+c*3+d*4,
       d,
       abs(a),
       c-d,
       a
  FROM t1
 ORDER BY 1,3,4,2,5
----
1014
101
104
1
104
1067
108
107
-2
107
1130
114
111
-1
111
1172
116
115
3
115
1226
122
121
1
121
1272
128
127
-3
127
1325
133
131
1
131
1371
136
138
1
138
1411
140
142
1
142
1472
148
149
-1
149
1521
154
153
-4
153
1564
156
159
-1
159
1622
164
163
-3
163
1676
169
168
-3
168
1714
171
174
1
174
1769
178
179
-2
179
1828
183
182
1
182
1861
185
188
2
188
1918
190
191
3
191
1964
196
199
-1
199
2019
203
201
-1
201
2069
207
205
1
205
2125
212
213
2
213
2165
217
216
-2
216
2226
222
220
2
220
2264
226
229
-1
229
2323
233
234
-2
234
2368
238
239
-3
239
2419
241
243
3
243
2476
248
245
-1
245

query IIIIIII nosort
SELECT c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       e,
       a,
       d-e,
       b-c,
       d
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
 ORDER BY 1,7,6,2,3,4,5
----
102
555
103
104
-2
-2
101
106
333
109
107
-1
-1
108
150
333
152
153
2
1
154
155
555
157
159
-1
3
156
161
333
162
163
2
-1
164
166
333
165
168
4
1
169
172
555
173
174
-2
-2
171
176
555
177
179
1
-1
178
184
333
180
182
3
-3
183
187
444
189
188
-4
-1
185
193
444
192
191
-2
1
190
195
555
197
199
-1
3
196
202
222
204
201
-1
-2
203
208
111
209
205
-2
-2
207
214
222
210
213
2
-3
212
215
333
219
216
-2
3
217
224
444
221
220
1
-1
222
225
555
227
229
-1
3
226
231
555
230
234
3
1
233
235
555
237
239
1
1
238
244
222
242
243
-1
-4
241
247
444
246
245
2
2
248

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d,
       b-c,
       c
  FROM t1
 ORDER BY 3,1,2,4
----
222
241
-4
244
444
133
-4
134
222
212
-3
214
333
183
-3
184
111
207
-2
208
222
203
-2
202
555
101
-2
102
555
148
-2
147
555
171
-2
172
111
114
-1
113
333
108
-1
106
333
116
-1
119
333
164
-1
161
444
185
-1
187
444
222
-1
224
555
178
-1
176
333
122
1
123
333
154
1
150
333
169
1
166
444
190
1
193
555
233
1
231
555
238
1
235
111
136
2
137
111
140
2
141
444
248
2
247
333
217
3
215
555
156
3
155
555
196
3
195
555
226
3
225
333
128
4
125

query I nosort
SELECT c
  FROM t1
 WHERE b>c
    OR (e>c OR e<d)
 ORDER BY 1
----
102
106
113
123
125
134
137
141
147
150
155
161
166
172
176
184
187
193
195
202
208
214
215
224
225
231
235
247

query III nosort
SELECT a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e
  FROM t1
 WHERE (e>c OR e<d)
    OR (c<=d-2 OR c>=d+2)
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 3,1,2
----
4
444
103
2
333
109
-1
222
110
-3
222
117
-3
222
120
-2
222
126
1
333
132
-1
222
135
-1
222
144
4
444
146
2
333
152
1
333
157
3
444
162
1
333
165
4
444
173
4
444
177
1
333
180
2
333
189
-3
222
192
1
333
197
1
333
204
-1
222
209
2
333
210
-2
222
219
-3
222
221
1
333
227
2
333
230
3
444
237
3
444
242
-4
111
246

query IIIII nosort
SELECT a+b*2+c*3,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d-e,
       c,
       abs(a)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 4,1,3,5,2
----
708
1180
-1
119
115
1158
382
-2
193
191
1338
440
1
224
220
1484
490
2
247
245

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       e,
       c-d,
       a+b*2+c*3,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a-b
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR e+d BETWEEN a+b-10 AND c+130
    OR c BETWEEN b-2 AND d+2
 ORDER BY 5,4,3,1,2,6
----
247
246
-1
1484
111
-4
112
110
-1
674
222
-1
117
117
3
708
222
-3
122
120
1
738
222
-3
127
126
-3
760
222
-2
137
135
1
827
222
-1
142
144
1
851
222
-1
207
209
1
1241
222
-1
222
221
2
1338
222
-3
107
109
-2
635
333
2
132
132
1
793
333
1
152
152
-4
905
333
2
157
157
-1
940
333
1
167
165
-3
1000
333
1
182
180
1
1096
333
1
187
189
2
1121
333
2
197
197
-1
1180
333
1
202
204
-1
1207
333
1
212
210
2
1277
333
2
227
227
-1
1360
333
1
232
230
-2
1391
333
2
102
103
1
610
444
4
147
146
-1
880
444
4
162
162
-3
966
444
3
172
173
1
1030
444
4
177
177
-2
1057
444
4
237
237
-3
1416
444
3

query II nosort
SELECT b,
       c
  FROM t1
 ORDER BY 2,1
----
100
102
105
106
112
113
118
119
124
123
129
125
130
134
139
137
143
141
145
147
151
150
158
155
160
161
167
166
170
172
175
176
181
184
186
187
194
193
198
195
200
202
206
208
211
214
218
215
223
224
228
225
232
231
236
235
240
244
249
247

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       a-b,
       b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       e
  FROM t1
 ORDER BY 1,5,4,3,2
----
0
4
100
1000
103
0
2
105
1050
109
0
-1
112
1120
110
0
-3
118
1180
117
0
-3
124
1240
120
0
-2
129
1290
126
0
1
130
1300
132
0
-1
139
1390
135
0
-1
143
1430
144
0
4
145
1450
146
0
2
151
1510
152
0
1
158
1580
157
0
3
160
1600
162
0
1
167
1670
165
0
4
170
1700
173
0
4
175
358
177
0
1
181
364
180
0
2
186
376
189
0
-3
194
382
192
0
1
198
398
197
0
1
200
402
204
0
-1
206
410
209
0
2
211
426
210
0
-2
218
432
219
0
-3
223
440
221
0
1
228
458
227
0
2
232
468
230
0
3
236
478
237
0
3
240
486
242
0
-4
249
490
246

query IIIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3,
       e,
       d,
       b-c,
       a
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (a>b-2 AND a<b+2)
 ORDER BY 2,4,5,6,1,3
----
1000
610
103
101
-2
104
1050
635
109
108
-1
107
1120
674
110
114
-1
111
1180
708
117
116
-1
115
1240
738
120
122
1
121
1290
760
126
128
4
127
1300
793
132
133
-4
131
1390
827
135
136
2
138
1430
851
144
140
2
142
1580
940
157
156
3
159
1670
1000
165
169
1
168
364
1096
180
183
-3
182
398
1180
197
196
3
199
402
1207
204
203
-2
201
410
1241
209
207
-2
205
458
1360
227
226
3
229

query III nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       d-e
  FROM t1
 ORDER BY 1,3,2
----
111
245
2
222
142
-4
222
191
-2
222
205
-2
222
216
-2
222
115
-1
222
138
1
222
220
1
222
121
2
222
127
2
222
111
4
333
188
-4
333
107
-1
333
159
-1
333
199
-1
333
201
-1
333
229
-1
333
131
1
333
153
2
333
213
2
333
182
3
333
234
3
333
168
4
444
104
-2
444
174
-2
444
243
-1
444
179
1
444
239
1
444
149
2
444
163
2

query IIIIIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       e,
       d,
       b-c,
       (a+b+c+d+e)/5,
       abs(b-c),
       a+b*2+c*3
  FROM t1
 ORDER BY 4,3,5,1,7,2,6
----
444
132
133
-4
132
4
793
222
242
241
-4
242
4
1455
333
180
183
-3
182
3
1096
222
210
212
-3
212
3
1277
555
103
101
-2
102
2
610
555
146
148
-2
147
2
880
555
173
171
-2
172
2
1030
222
204
203
-2
202
2
1207
111
209
207
-2
207
2
1241
333
109
108
-1
107
1
635
111
110
114
-1
112
1
674
333
117
116
-1
117
1
708
333
162
164
-1
162
1
966
555
177
178
-1
177
1
1057
444
189
185
-1
187
1
1121
444
221
222
-1
222
1
1338
333
120
122
1
122
1
738
333
152
154
1
152
1
905
333
165
169
1
167
1
1000
444
192
190
1
192
1
1158
555
230
233
1
232
1
1391
555
237
238
1
237
1
1416
111
135
136
2
137
2
827
111
144
140
2
142
2
851
444
246
248
2
247
2
1484
555
157
156
3
157
3
940
555
197
196
3
197
3
1180
333
219
217
3
217
3
1297
555
227
226
3
227
3
1360
333
126
128
4
127
4
760

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       c-d,
       a+b*2+c*3+d*4,
       d-e,
       b-c,
       e,
       a+b*2+c*3+d*4+e*5
  FROM t1
 ORDER BY 7,1,2,4,6,5,3
----
102
1
1014
-2
-2
103
1529
107
-2
1067
-1
-1
109
1612
112
-1
1130
4
-1
110
1680
117
3
1172
-1
-1
117
1757
122
1
1226
2
1
120
1826
127
-3
1272
2
4
126
1902
132
1
1325
1
-4
132
1985
137
1
1371
1
2
135
2046
142
1
1411
-4
2
144
2131
147
-1
1472
2
-2
146
2202
152
-4
1521
2
1
152
2281
157
-1
1564
-1
3
157
2349
162
-3
1622
2
-1
162
2432
167
-3
1676
4
1
165
2501
172
1
1714
-2
-2
173
2579
177
-2
1769
1
-1
177
2654
182
1
1828
3
-3
180
2728
187
2
1861
-4
-1
189
2806
192
3
1918
-2
1
192
2878
197
-1
1964
-1
3
197
2949
202
-1
2019
-1
-2
204
3039
207
1
2069
-2
-2
209
3114
212
2
2125
2
-3
210
3175
217
-2
2165
-2
3
219
3260
222
2
2226
1
-1
221
3331
227
-1
2264
-1
3
227
3399
232
-2
2323
3
1
230
3473
237
-3
2368
1
1
237
3553
242
3
2419
-1
-4
242
3629
247
-1
2476
2
2
246
3706

query II nosort
SELECT c,
       b
  FROM t1
 WHERE a>b
    OR b>c
 ORDER BY 1,2
----
102
100
106
105
123
124
125
129
134
130
137
139
141
143
147
145
150
151
155
158
161
160
166
167
172
170
176
175
184
181
187
186
193
194
195
198
202
200
214
211
215
218
225
228
231
232
235
236
244
240
247
249

query IIIIII nosort
SELECT b-c,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       a,
       a+b*2,
       a+b*2+c*3,
       e
  FROM t1
 WHERE (e>c OR e<d)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1,5,2,4,6,3
----
-4
444
131
391
793
132
-3
333
182
544
1096
180
-3
222
213
635
1277
210
-2
555
104
304
610
103
-2
555
149
439
880
146
-2
555
174
514
1030
173
-2
222
201
601
1207
204
-2
111
205
617
1241
209
-1
333
107
317
635
109
-1
111
111
335
674
110
-1
333
163
483
966
162
-1
555
179
529
1057
177
-1
444
188
560
1121
189
-1
444
220
666
1338
221
1
333
121
369
738
120
1
333
153
455
905
152
1
333
168
502
1000
165
1
555
234
698
1391
230
1
555
239
711
1416
237
2
111
138
416
827
135
2
111
142
428
851
144
2
444
245
743
1484
246
3
555
159
475
940
157
3
555
199
595
1180
197
3
333
216
652
1297
219
3
555
229
685
1360
227
4
333
127
385
760
126

query I nosort
SELECT a+b*2+c*3
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----
610
635
674
708
738
760

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c),
       abs(a),
       b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND d>e
 ORDER BY 1,5,3,2,4
----
358
1
179
175
444
364
3
182
181
333
426
3
213
211
333
440
1
220
223
222
468
1
234
232
333
478
1
239
236
444
490
2
245
249
111
1510
1
153
151
333
1600
1
163
160
444
1670
1
168
167
333

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       d-e,
       a+b*2+c*3+d*4
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 1,3,4,2
----
333
1180
-1
1172
444
382
-2
1918
444
440
1
2226
444
490
2
2476

query IIII nosort
SELECT CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       (a+b+c+d+e)/5
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
    OR d>e
    OR a>b
 ORDER BY 2,3,1,4
----
555
0
0
102
333
0
1
107
111
0
2
112
333
0
4
122
333
0
5
127
444
0
6
132
111
0
7
137
111
0
8
142
555
0
9
147
333
0
10
152
555
0
11
157
333
0
12
162
333
0
13
167
555
0
14
172
555
0
15
177
333
0
16
182
444
0
17
187
555
0
19
197
222
0
20
202
111
0
21
207
222
0
22
212
444
0
24
222
555
0
25
227
555
0
26
232
555
0
27
237
222
0
28
242
444
0
29
247

query IIIIII nosort
SELECT b,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       abs(b-c),
       a-b,
       abs(a),
       (a+b+c+d+e)/5
  FROM t1
 WHERE (e>a AND e<b)
   AND d NOT BETWEEN 110 AND 150
   AND c>d
 ORDER BY 5,4,2,3,1,6
----
194
444
1
-3
191
192
223
444
1
-3
220
222

query I nosort
SELECT e
  FROM t1
 WHERE (e>c OR e<d)
    OR (c<=d-2 OR c>=d+2)
    OR (e>a AND e<b)
 ORDER BY 1
----
103
109
110
117
120
126
132
135
144
146
152
157
162
165
173
177
180
189
192
197
204
209
210
219
221
227
230
237
242
246

query I nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
   AND (e>c OR e<d)
 ORDER BY 1
----
2
6
7
8
11
13
16
19
20
21
25

query I nosort
SELECT abs(a)
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR d>e
    OR (e>c OR e<d)
 ORDER BY 1
----
104
107
111
121
127
131
138
142
149
153
159
163
168
174
179
182
188
199
201
205
213
216
220
229
234
239
245

query IIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       c,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       c-d,
       a-b,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 4,2,3,6,1,5
----
2281
150
333
-4
2
152
1902
125
222
-3
-2
127
2432
161
444
-3
3
162
2501
166
333
-3
1
167
3553
235
444
-3
3
237
1612
106
333
-2
2
107
2654
176
444
-2
4
177
3260
215
222
-2
-2
217
3473
231
333
-2
2
232
1680
113
222
-1
-1
112
2202
147
444
-1
4
147
2349
155
333
-1
1
157
2949
195
333
-1
1
197
3039
202
333
-1
1
202
3399
225
333
-1
1
227
3706
247
111
-1
-4
247
1529
102
444
1
4
102
1826
123
222
1
-3
122
1985
134
333
1
1
132
2046
137
222
1
-1
137
2131
141
222
1
-1
142
2579
172
444
1
4
172
2728
184
333
1
1
182
3114
208
222
1
-1
207
2806
187
333
2
2
187
3175
214
333
2
2
212
3331
224
222
2
-3
222
1757
119
222
3
-3
117
2878
193
222
3
-3
192
3629
244
444
3
3
242

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR d NOT BETWEEN 110 AND 150
 ORDER BY 1
----
1014
1067
1172
1272
1521
1564
1622
1676
1714
1769
1828
1861
1918
1964
2019
2069
2125
2165
2226
2264
2323
2368
2419
2476

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       d,
       a+b*2,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       c-d,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 6,7,2,4,1,5,3
----
152
154
455
10
1
-4
1510
237
238
711
27
1
-3
478
127
128
385
5
4
-3
1290
162
164
483
12
-1
-3
1600
167
169
502
13
1
-3
1670
177
178
529
15
-1
-2
358
217
217
652
23
3
-2
432
232
233
698
26
1
-2
468
107
108
317
1
-1
-2
1050
197
196
595
19
3
-1
398
202
203
601
20
-2
-1
402
227
226
685
25
3
-1
458
247
248
743
29
2
-1
490
112
114
335
2
-1
-1
1120
147
148
439
9
-2
-1
1450
157
156
475
11
3
-1
1580
182
183
544
16
-3
1
364
207
207
617
21
-2
1
410
102
101
304
0
-2
1
1000
122
122
369
4
1
1
1240
132
133
391
6
-4
1
1300
137
136
416
7
2
1
1390
142
140
428
8
2
1
1430
172
171
514
14
-2
1
1700
187
185
560
17
-1
2
376
212
212
635
22
-3
2
426
222
222
666
24
-1
2
440
192
190
579
18
1
3
382
242
241
723
28
-4
3
486
117
116
351
3
-1
3
1180

query IIIIIII nosort
SELECT d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       (a+b+c+d+e)/5,
       b,
       a,
       a+b*2,
       d-e
  FROM t1
 ORDER BY 5,1,6,7,2,3,4
----
101
444
102
100
104
304
-2
108
333
107
105
107
317
-1
114
222
112
112
111
335
4
116
222
117
118
115
351
-1
122
222
122
124
121
369
2
128
222
127
129
127
385
2
133
333
132
130
131
391
1
136
222
137
139
138
416
1
140
222
142
143
142
428
-4
148
444
147
145
149
439
2
154
333
152
151
153
455
2
156
333
157
158
159
475
-1
164
444
162
160
163
483
2
169
333
167
167
168
502
4
171
444
172
170
174
514
-2
178
444
177
175
179
529
1
183
333
182
181
182
544
3
185
333
187
186
188
560
-4
190
222
192
194
191
579
-2
196
333
197
198
199
595
-1
203
333
202
200
201
601
-1
207
222
207
206
205
617
-2
212
333
212
211
213
635
2
217
222
217
218
216
652
-2
222
222
222
223
220
666
1
226
333
227
228
229
685
-1
233
333
232
232
234
698
3
238
444
237
236
239
711
1
241
444
242
240
243
723
-1
248
111
247
249
245
743
2

query III nosort
SELECT c,
       a-b,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 ORDER BY 1,2,3
----
102
4
444
106
2
333
113
-1
222
119
-3
222
123
-3
222
125
-2
222
134
1
333
137
-1
222
141
-1
222
147
4
444
150
2
333
155
1
333
161
3
444
166
1
333
172
4
444
176
4
444
184
1
333
187
2
333
193
-3
222
195
1
333
202
1
333
208
-1
222
214
2
333
215
-2
222
224
-3
222
225
1
333
231
2
333
235
3
444
244
3
444
247
-4
111

query IIIIII nosort
SELECT abs(a),
       e,
       a-b,
       a,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       d-e
  FROM t1
 WHERE a>b
    OR d NOT BETWEEN 110 AND 150
    OR b>c
 ORDER BY 4,6,1,2,3,5
----
104
103
4
104
555
-2
107
109
2
107
333
-1
121
120
-3
121
333
2
127
126
-2
127
333
2
131
132
1
131
444
1
138
135
-1
138
111
1
142
144
-1
142
111
-4
149
146
4
149
555
2
153
152
2
153
333
2
159
157
1
159
555
-1
163
162
3
163
333
2
168
165
1
168
333
4
174
173
4
174
555
-2
179
177
4
179
555
1
182
180
1
182
333
3
188
189
2
188
444
-4
191
192
-3
191
444
-2
199
197
1
199
555
-1
201
204
1
201
222
-1
205
209
-1
205
111
-2
213
210
2
213
222
2
216
219
-2
216
333
-2
220
221
-3
220
444
1
229
227
1
229
555
-1
234
230
2
234
555
3
239
237
3
239
555
1
243
242
3
243
222
-1
245
246
-4
245
444
2

query IIIIII nosort
SELECT e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       b,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (c<=d-2 OR c>=d+2)
 ORDER BY 4,2,1,6,5,3
----
109
1050
105
1612
1
107
152
1510
151
2281
10
153
162
1600
160
2432
12
163
165
1670
167
2501
13
168
177
358
175
2654
15
179
189
376
186
2806
17
188
192
382
194
2878
18
191
210
426
211
3175
22
213
219
432
218
3260
23
216
221
440
223
3331
24
220
230
468
232
3473
26
234
237
478
236
3553
27
239
242
486
240
3629
28
243

query IIIIII nosort
SELECT b-c,
       a+b*2+c*3,
       a+b*2,
       c-d,
       (a+b+c+d+e)/5,
       a-b
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND d NOT BETWEEN 110 AND 150
   AND d>e
 ORDER BY 6,1,5,3,2,4
----

query IIIII nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(a),
       a+b*2,
       a,
       d-e
  FROM t1
 WHERE (e>c OR e<d)
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 4,2,3,5,1
----
1000
104
304
104
-2
1050
107
317
107
-1
1120
111
335
111
4
1180
115
351
115
-1
1240
121
369
121
2
1290
127
385
127
2
1300
131
391
131
1
1390
138
416
138
1
1430
142
428
142
-4
1450
149
439
149
2
1510
153
455
153
2
1580
159
475
159
-1
1600
163
483
163
2
1670
168
502
168
4
1700
174
514
174
-2
358
179
529
179
1
364
182
544
182
3
376
188
560
188
-4
382
191
579
191
-2
398
199
595
199
-1
402
201
601
201
-1
410
205
617
205
-2
426
213
635
213
2
432
216
652
216
-2
440
220
666
220
1
458
229
685
229
-1
468
234
698
234
3
478
239
711
239
1
486
243
723
243
-1
490
245
743
245
2

query III nosort
SELECT a+b*2+c*3+d*4+e*5,
       b,
       a-b
  FROM t1
 ORDER BY 1,2,3
----
1529
100
4
1612
105
2
1680
112
-1
1757
118
-3
1826
124
-3
1902
129
-2
1985
130
1
2046
139
-1
2131
143
-1
2202
145
4
2281
151
2
2349
158
1
2432
160
3
2501
167
1
2579
170
4
2654
175
4
2728
181
1
2806
186
2
2878
194
-3
2949
198
1
3039
200
1
3114
206
-1
3175
211
2
3260
218
-2
3331
223
-3
3399
228
1
3473
232
2
3553
236
3
3629
240
3
3706
249
-4

query IIIIII nosort
SELECT (a+b+c+d+e)/5,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       abs(b-c),
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b-c
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (c<=d-2 OR c>=d+2)
    OR d>e
 ORDER BY 2,1,3,5,6,4
----
152
-4
10
1
0
1
127
-3
5
4
0
4
162
-3
12
1
0
-1
167
-3
13
1
0
1
237
-3
27
1
0
1
107
-2
1
1
0
-1
177
-2
15
1
0
-1
217
-2
23
3
0
3
232
-2
26
1
0
1
112
-1
2
1
0
-1
147
-1
9
2
0
-2
247
-1
29
2
0
2
102
1
0
2
0
-2
122
1
4
1
0
1
132
1
6
4
0
-4
137
1
7
2
0
2
182
1
16
3
0
-3
187
2
17
1
0
-1
212
2
22
3
0
-3
222
2
24
1
0
-1
117
3
3
1
0
-1
192
3
18
1
0
1
242
3
28
4
0
-4

query II nosort
SELECT d,
       a+b*2+c*3+d*4
  FROM t1
 ORDER BY 1,2
----
101
1014
108
1067
114
1130
116
1172
122
1226
128
1272
133
1325
136
1371
140
1411
148
1472
154
1521
156
1564
164
1622
169
1676
171
1714
178
1769
183
1828
185
1861
190
1918
196
1964
203
2019
207
2069
212
2125
217
2165
222
2226
226
2264
233
2323
238
2368
241
2419
248
2476

query IIIIIII nosort
SELECT abs(a),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3+d*4,
       e,
       d,
       a,
       b-c
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (e>c OR e<d)
 ORDER BY 5,1,7,2,3,6,4
----
104
1000
1014
103
101
104
-2
107
1050
1067
109
108
107
-1
111
1120
1130
110
114
111
-1
115
1180
1172
117
116
115
-1
121
1240
1226
120
122
121
1
127
1290
1272
126
128
127
4
131
1300
1325
132
133
131
-4
138
1390
1371
135
136
138
2
142
1430
1411
144
140
142
2
149
1450
1472
146
148
149
-2
153
1510
1521
152
154
153
1
159
1580
1564
157
156
159
3
163
1600
1622
162
164
163
-1
168
1670
1676
165
169
168
1
174
1700
1714
173
171
174
-2
179
358
1769
177
178
179
-1
182
364
1828
180
183
182
-3
188
376
1861
189
185
188
-1
199
398
1964
197
196
199
3
201
402
2019
204
203
201
-2
205
410
2069
209
207
205
-2
213
426
2125
210
212
213
-3
216
432
2165
219
217
216
3
220
440
2226
221
222
220
-1
229
458
2264
227
226
229
3
234
468
2323
230
233
234
1
239
478
2368
237
238
239
1
245
490
2476
246
248
245
2

query II nosort
SELECT abs(a),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE a>b
    OR b>c
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 2,1
----
138
111
142
111
201
222
213
222
243
222
107
333
115
333
121
333
127
333
153
333
163
333
168
333
182
333
216
333
131
444
188
444
191
444
220
444
245
444
104
555
149
555
159
555
174
555
179
555
199
555
229
555
234
555
239
555

query I nosort
SELECT a-b
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
   AND (e>c OR e<d)
   AND a>b
 ORDER BY 1
----
1
1
1
1
1
1
2
2
2
2
2
3
3
4
4
4

query III nosort
SELECT a,
       (a+b+c+d+e)/5,
       c
  FROM t1
 WHERE a>b
    OR c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
 ORDER BY 1,2,3
----
104
102
102
107
107
106
111
112
113
121
122
123
127
127
125
131
132
134
138
137
137
142
142
141
149
147
147
153
152
150
159
157
155
163
162
161
168
167
166
174
172
172
179
177
176
182
182
184
188
187
187
199
197
195
201
202
202
205
207
208
213
212
214
216
217
215
220
222
224
229
227
225
234
232
231
239
237
235
243
242
244
245
247
247

query IIIIIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       a-b,
       b,
       a+b*2+c*3+d*4,
       a+b*2+c*3,
       d-e,
       abs(b-c)
  FROM t1
 WHERE b>c
   AND a>b
   AND c>d
 ORDER BY 4,2,1,7,5,6,3
----

query I nosort
SELECT a+b*2
  FROM t1
 WHERE a>b
 ORDER BY 1
----
304
317
391
439
455
475
483
502
514
529
544
560
595
601
635
685
698
711
723

query II nosort
SELECT (a+b+c+d+e)/5,
       d-e
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 2,1
----
142
-4
187
-4
102
-2
172
-2
207
-2
107
-1
202
-1
132
1
137
1
177
1
222
1
237
1
122
2
147
2
152
2
162
2
212
2
247
2
182
3
232
3
112
4
167
4

query I nosort
SELECT d
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (e>a AND e<b)
 ORDER BY 1
----
101
108
114
116
122
128
190
222
248

query IIIIII nosort
SELECT d-e,
       c-d,
       b,
       b-c,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR e+d BETWEEN a+b-10 AND c+130
 ORDER BY 5,3,4,2,6,1
----
-1
-2
105
-1
1
333
4
-1
112
-1
1
111
-1
3
118
-1
1
333
2
1
124
1
1
333
4
-3
167
1
1
333
-2
1
100
-2
2
555
1
1
139
2
2
111
-4
1
143
2
2
111
-1
-1
200
-2
2
222
-2
1
206
-2
2
111
-1
-1
158
3
3
555
3
1
181
-3
3
333
-1
-1
198
3
3
555
-1
-1
228
3
3
555
2
-3
129
4
4
333
1
1
130
-4
4
444

query IIIIIII nosort
SELECT a+b*2+c*3+d*4,
       d,
       c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       a+b*2+c*3
  FROM t1
 ORDER BY 6,3,7,2,1,5,4
----
1014
101
1
444
104
0
610
1067
108
-2
333
107
1
635
1130
114
-1
222
111
2
674
1172
116
3
222
115
3
708
1226
122
1
222
121
4
738
1272
128
-3
222
127
5
760
1325
133
1
333
131
6
793
1371
136
1
222
138
7
827
1411
140
1
222
142
8
851
1472
148
-1
444
149
9
880
1521
154
-4
333
153
10
905
1564
156
-1
333
159
11
940
1622
164
-3
444
163
12
966
1676
169
-3
333
168
13
1000
1714
171
1
444
174
14
1030
1769
178
-2
444
179
15
1057
1828
183
1
333
182
16
1096
1861
185
2
333
188
17
1121
1918
190
3
222
191
18
1158
1964
196
-1
333
199
19
1180
2019
203
-1
333
201
20
1207
2069
207
1
222
205
21
1241
2125
212
2
333
213
22
1277
2165
217
-2
222
216
23
1297
2226
222
2
222
220
24
1338
2264
226
-1
333
229
25
1360
2323
233
-2
333
234
26
1391
2368
238
-3
444
239
27
1416
2419
241
3
444
243
28
1455
2476
248
-1
111
245
29
1484

query I nosort
SELECT a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND (e>a AND e<b)
   AND e+d BETWEEN a+b-10 AND c+130
 ORDER BY 1
----

query II nosort
SELECT a+b*2,
       a+b*2+c*3
  FROM t1
 WHERE b>c
 ORDER BY 1,2
----
369
738
385
760
416
827
428
851
455
905
475
940
502
1000
579
1158
595
1180
652
1297
685
1360
698
1391
711
1416
743
1484

query II nosort
SELECT b-c,
       a+b*2+c*3+d*4
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
   AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 2,1
----
-1
1067
-1
1130
1
1226
-4
1325
2
1371
2
1411
-2
1472
1
1521
-1
1622
1
1676
-2
1714
-1
1769
-3
1828
-1
1861
-2
2019
-2
2069
-3
2125
-1
2226
1
2323
1
2368
2
2476

query IIII nosort
SELECT e,
       a+b*2+c*3+d*4+e*5,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END
  FROM t1
 ORDER BY 2,3,4,1
----
103
1529
0
1000
109
1612
0
1050
110
1680
0
1120
117
1757
0
1180
120
1826
0
1240
126
1902
0
1290
132
1985
0
1300
135
2046
0
1390
144
2131
0
1430
146
2202
0
1450
152
2281
0
1510
157
2349
0
1580
162
2432
0
1600
165
2501
0
1670
173
2579
0
1700
177
2654
0
358
180
2728
0
364
189
2806
0
376
192
2878
0
382
197
2949
0
398
204
3039
0
402
209
3114
0
410
210
3175
0
426
219
3260
0
432
221
3331
0
440
227
3399
0
458
230
3473
0
468
237
3553
0
478
242
3629
0
486
246
3706
0
490

query I nosort
SELECT abs(b-c)
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 1
----
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3
3
4

query IIIIII nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       b,
       abs(a),
       (a+b+c+d+e)/5,
       abs(b-c)
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 6,5,4,1,3,2
----
708
1757
118
115
117
1
1158
2878
194
191
192
1
1338
3331
223
220
222
1
1484
3706
249
245
247
2

query IIIII nosort
SELECT c,
       a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2,
       d
  FROM t1
 WHERE (a>b-2 AND a<b+2)
    OR a>b
 ORDER BY 1,3,4,5,2
----
102
4
1000
304
101
106
2
1050
317
108
113
-1
1120
335
114
134
1
1300
391
133
137
-1
1390
416
136
141
-1
1430
428
140
147
4
1450
439
148
150
2
1510
455
154
155
1
1580
475
156
161
3
1600
483
164
166
1
1670
502
169
172
4
1700
514
171
176
4
358
529
178
184
1
364
544
183
187
2
376
560
185
195
1
398
595
196
202
1
402
601
203
208
-1
410
617
207
214
2
426
635
212
225
1
458
685
226
231
2
468
698
233
235
3
478
711
238
244
3
486
723
241

query IIIIIII nosort
SELECT d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END,
       c-d,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d),
       b,
       abs(a),
       a+b*2+c*3
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 2,3,6,7,1,5,4
----
-1
333
3
0
118
115
708
2
444
-1
0
249
245
1484
1
444
2
0
223
220
1338
-2
444
3
0
194
191
1158

query I nosort
SELECT a+b*2+c*3+d*4
  FROM t1
 WHERE (e>c OR e<d)
   AND c BETWEEN b-2 AND d+2
 ORDER BY 1
----
1014
1067
1130
1226
1325
1371
1411
1472
1521
1622
1676
1714
1769
1828
1861
2019
2069
2125
2226
2323
2368
2476

query IIIII nosort
SELECT b,
       e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       c-d,
       d-e
  FROM t1
 WHERE d>e
   AND (e>c OR e<d)
 ORDER BY 2,1,3,4,5
----
112
110
1120
-1
4
124
120
1240
1
2
129
126
1290
-3
2
130
132
1300
1
1
139
135
1390
1
1
145
146
1450
-1
2
151
152
1510
-4
2
160
162
1600
-3
2
167
165
1670
-3
4
175
177
358
-2
1
181
180
364
1
3
211
210
426
2
2
223
221
440
2
1
232
230
468
-2
3
236
237
478
-3
1
249
246
490
-1
2

query III nosort
SELECT d-e,
       c,
       d
  FROM t1
 ORDER BY 3,2,1
----
-2
102
101
-1
106
108
4
113
114
-1
119
116
2
123
122
2
125
128
1
134
133
1
137
136
-4
141
140
2
147
148
2
150
154
-1
155
156
2
161
164
4
166
169
-2
172
171
1
176
178
3
184
183
-4
187
185
-2
193
190
-1
195
196
-1
202
203
-2
208
207
2
214
212
-2
215
217
1
224
222
-1
225
226
3
231
233
1
235
238
-1
244
241
2
247
248

query II nosort
SELECT d-e,
       c
  FROM t1
 WHERE (e>a AND e<b)
 ORDER BY 1,2
----
-2
193
-1
119
1
224
2
247

query IIIII nosort
SELECT (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       b-c,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       abs(b-c),
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE d>e
    OR EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1,3,2,5,4
----
1
-1
1050
1
333
2
-1
1120
1
111
3
-1
1180
1
333
4
1
1240
1
333
5
4
1290
4
333
6
-4
1300
4
444
7
2
1390
2
111
8
2
1430
2
111
9
-2
1450
2
555
10
1
1510
1
333
11
3
1580
3
555
12
-1
1600
1
333
13
1
1670
1
333
14
-2
1700
2
555
15
-1
358
1
555
16
-3
364
3
333
17
-1
376
1
444
18
1
382
1
444
19
3
398
3
555
20
-2
402
2
222
21
-2
410
2
111
22
-3
426
3
222
23
3
432
3
333
24
-1
440
1
444
25
3
458
3
555
26
1
468
1
555
27
1
478
1
555
28
-4
486
4
222
29
2
490
2
444

query III nosort
SELECT a+b*2+c*3,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
    OR c>d
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 2,3,1
----
610
1529
444
635
1612
333
674
1680
222
708
1757
222
738
1826
222
760
1902
222
793
1985
333
827
2046
222
851
2131
222
880
2202
444
905
2281
333
940
2349
333
966
2432
444
1000
2501
333
1030
2579
444
1057
2654
444
1096
2728
333
1121
2806
333
1158
2878
222
1180
2949
333
1207
3039
333
1241
3114
222
1277
3175
333
1297
3260
222
1338
3331
222
1360
3399
333
1391
3473
333
1416
3553
444
1455
3629
444
1484
3706
111

query II nosort
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2
  FROM t1
 WHERE (e>c OR e<d)
    OR (e>a AND e<b)
 ORDER BY 1,2
----
358
529
364
544
376
560
382
579
398
595
402
601
410
617
426
635
432
652
440
666
458
685
468
698
478
711
490
743
1000
304
1050
317
1120
335
1180
351
1240
369
1290
385
1300
391
1390
416
1430
428
1450
439
1510
455
1580
475
1600
483
1670
502
1700
514

query IIIIII nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e,
       a-b,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       (a+b+c+d+e)/5,
       abs(b-c)
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
   AND c>d
 ORDER BY 1,3,5,2,6,4
----
222
117
-3
1180
117
1
222
120
-3
1240
122
1
444
103
4
1000
102
2

query I nosort
SELECT a+b*2
  FROM t1
 WHERE c>d
    OR e+d BETWEEN a+b-10 AND c+130
    OR (c<=d-2 OR c>=d+2)
 ORDER BY 1
----
304
317
335
351
369
385
391
416
428
455
483
502
514
529
544
560
579
617
635
652
666
698
711
723

query II nosort
SELECT c,
       (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d)
  FROM t1
 WHERE b>c
   AND (e>a AND e<b)
   AND d>e
 ORDER BY 1,2
----
247
0

query IIIIII nosort
SELECT a-b,
       d,
       d-e,
       a,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333  WHEN e THEN 444 ELSE 555 END
  FROM t1
 WHERE a>b
 ORDER BY 3,5,4,2,1,6
----
2
185
-4
188
333
444
4
101
-2
104
444
555
4
171
-2
174
444
555
2
108
-1
107
333
333
1
156
-1
159
333
555
1
196
-1
199
333
555
1
203
-1
201
333
222
1
226
-1
229
333
555
3
241
-1
243
444
222
1
133
1
131
333
444
4
178
1
179
444
555
3
238
1
239
444
555
2
154
2
153
333
333
2
212
2
213
333
222
4
148
2
149
444
555
3
164
2
163
444
333
1
183
3
182
333
333
2
233
3
234
333
555
1
169
4
168
333
333

query IIII nosort
SELECT a+b*2+c*3+d*4+e*5,
       b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       e
  FROM t1
 ORDER BY 2,3,4,1
----
1529
100
0
103
1612
105
1
109
1680
112
2
110
1757
118
3
117
1826
124
4
120
1902
129
5
126
1985
130
6
132
2046
139
7
135
2131
143
8
144
2202
145
9
146
2281
151
10
152
2349
158
11
157
2432
160
12
162
2501
167
13
165
2579
170
14
173
2654
175
15
177
2728
181
16
180
2806
186
17
189
2878
194
18
192
2949
198
19
197
3039
200
20
204
3114
206
21
209
3175
211
22
210
3260
218
23
219
3331
223
24
221
3399
228
25
227
3473
232
26
230
3553
236
27
237
3629
240
28
242
3706
249
29
246

query III nosort
SELECT c,
       a+b*2+c*3+d*4,
       a
  FROM t1
 WHERE (e>a AND e<b)
    OR c BETWEEN b-2 AND d+2
 ORDER BY 1,2,3
----
102
1014
104
106
1067
107
113
1130
111
119
1172
115
123
1226
121
134
1325
131
137
1371
138
141
1411
142
147
1472
149
150
1521
153
161
1622
163
166
1676
168
172
1714
174
176
1769
179
184
1828
182
187
1861
188
193
1918
191
202
2019
201
208
2069
205
214
2125
213
224
2226
220
231
2323
234
235
2368
239
247
2476
245

query IIIIIII nosort
SELECT (a+b+c+d+e)/5,
       b,
       a+b*2+c*3+d*4+e*5,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       e,
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 1,3,2,5,4,7,6
----
102
100
1529
444
103
1000
610
107
105
1612
333
109
1050
635
112
112
1680
222
110
1120
674
122
124
1826
222
120
1240
738
132
130
1985
333
132
1300
793
137
139
2046
222
135
1390
827
142
143
2131
222
144
1430
851
147
145
2202
444
146
1450
880
152
151
2281
333
152
1510
905
162
160
2432
444
162
1600
966
167
167
2501
333
165
1670
1000
172
170
2579
444
173
1700
1030
177
175
2654
444
177
358
1057
182
181
2728
333
180
364
1096
187
186
2806
333
189
376
1121
202
200
3039
333
204
402
1207
207
206
3114
222
209
410
1241
212
211
3175
333
210
426
1277
222
223
3331
222
221
440
1338
232
232
3473
333
230
468
1391
237
236
3553
444
237
478
1416
247
249
3706
111
246
490
1484

query II nosort
SELECT d-e,
       a+b*2+c*3
  FROM t1
 ORDER BY 2,1
----
-2
610
-1
635
4
674
-1
708
2
738
2
760
1
793
1
827
-4
851
2
880
2
905
-1
940
2
966
4
1000
-2
1030
1
1057
3
1096
-4
1121
-2
1158
-1
1180
-1
1207
-2
1241
2
1277
-2
1297
1
1338
-1
1360
3
1391
1
1416
-1
1455
2
1484

query II nosort
SELECT CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a
  FROM t1
 ORDER BY 1,2
----
111
245
222
111
222
115
222
121
222
127
222
138
222
142
222
191
222
205
222
216
222
220
333
107
333
131
333
153
333
159
333
168
333
182
333
188
333
199
333
201
333
213
333
229
333
234
444
104
444
149
444
163
444
174
444
179
444
239
444
243

query IIII nosort
SELECT abs(b-c),
       a+b*2+c*3+d*4+e*5,
       b,
       d-e
  FROM t1
 WHERE (c<=d-2 OR c>=d+2)
    OR d>e
 ORDER BY 3,1,2,4
----
1
1612
105
-1
1
1680
112
4
1
1757
118
-1
1
1826
124
2
4
1902
129
2
4
1985
130
1
2
2046
139
1
2
2202
145
2
1
2281
151
2
1
2432
160
2
1
2501
167
4
1
2654
175
1
3
2728
181
3
1
2806
186
-4
1
2878
194
-2
3
3175
211
2
3
3260
218
-2
1
3331
223
1
1
3473
232
3
1
3553
236
1
4
3629
240
-1
2
3706
249
2

query IIIIII nosort
SELECT c-d,
       CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222
        WHEN a<b+3 THEN 333 ELSE 444 END,
       a+b*2,
       e,
       c,
       a+b*2+c*3+d*4
  FROM t1
 WHERE e+d BETWEEN a+b-10 AND c+130
    OR (e>c OR e<d)
 ORDER BY 2,4,6,5,3,1
----
-1
111
743
246
247
2476
-1
222
335
110
113
1130
3
222
351
117
119
1172
1
222
369
120
123
1226
-3
222
385
126
125
1272
1
222
416
135
137
1371
1
222
428
144
141
1411
1
222
617
209
208
2069
-2
222
652
219
215
2165
2
222
666
221
224
2226
-2
333
317
109
106
1067
1
333
391
132
134
1325
-4
333
455
152
150
1521
-1
333
475
157
155
1564
-3
333
502
165
166
1676
1
333
544
180
184
1828
2
333
560
189
187
1861
-1
333
595
197
195
1964
-1
333
601
204
202
2019
2
333
635
210
214
2125
-1
333
685
227
225
2264
-2
333
698
230
231
2323
1
444
304
103
102
1014
-1
444
439
146
147
1472
-3
444
483
162
161
1622
1
444
514
173
172
1714
-2
444
529
177
176
1769
-3
444
711
237
235
2368

query IIIIII nosort
SELECT b,
       a-b,
       (SELECT count(*) FROM t1 AS x WHERE x.b<t1.b),
       CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END,
       a+b*2+c*3,
       a+b*2+c*3+d*4+e*5
  FROM t1
 WHERE c BETWEEN b-2 AND d+2
 ORDER BY 5,2,4,1,3,6
----
100
4
0
1000
610
1529
105
2
1
1050
635
1612
112
-1
2
1120
674
1680
124
-3
4
1240
738
1826
130
1
6
1300
793
1985
139
-1
7
1390
827
2046
143
-1
8
1430
851
2131
145
4
9
1450
880
2202
151
2
10
1510
905
2281
160
3
12
1600
966
2432
167
1
13
1670
1000
2501
170
4
14
1700
1030
2579
175
4
15
358
1057
2654
181
1
16
364
1096
2728
186
2
17
376
1121
2806
200
1
20
402
1207
3039
206
-1
21
410
1241
3114
211
2
22
426
1277
3175
223
-3
24
440
1338
3331
232
2
26
468
1391
3473
236
3
27
478
1416
3553
249
-4
29
490
1484
3706

query III nosort
SELECT a,
       a+b*2+c*3,
       (a+b+c+d+e)/5
  FROM t1
 ORDER BY 2,3,1
----
104
610
102
107
635
107
111
674
112
115
708
117
121
738
122
127
760
127
131
793
132
138
827
137
142
851
142
149
880
147
153
905
152
159
940
157
163
966
162
168
1000
167
174
1030
172
179
1057
177
182
1096
182
188
1121
187
191
1158
192
199
1180
197
201
1207
202
205
1241
207
213
1277
212
216
1297
217
220
1338
222
229
1360
227
234
1391
232
239
1416
237
243
1455
242
245
1484
247

query I nosort
SELECT c
  FROM t1
 WHERE EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b)
 ORDER BY 1
----
106
113
119
123
125
134
137
141
147
150
155
161
166
172
176
184
187
193
195
202
208
214
215
224
225
231
235
244
247

