-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult.txt
957 lines (720 loc) · 61.6 KB
/
result.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
QUERY TO PARSE:
SELECT f.* a1, ( ( (
SELECT sum
(a.flight_id ) ss FROM flights a GROUP BY a.flight_id )
)
)s
FROM (
select
*
from
flights )f
INNER JOIN aircrafts air
ON (
(
air.aircraft_code = f.aircraft_code and air.aircraft_code=f.aircraft_code ) or ( ( 1=1 and 1 =1) or ( (2>3 and 4<2) or ( 3 != 3 and 2 <> 1 ) ) ) )
FULL OUTER JOIN aircrafts_data ad ON ad.aircraft_code = air.aircraft_code
LEFT JOIN airports_data apd ON apd.airport_code = f.aircraft_code and f.flight_id = 10 * 10 ^ 2
WHERE
(
f.flight_no
='a'
and (
( ( f.aircraft_code = 'asd' or f.aircraft_code='5454')
and f.aircraft_code='2332' ) or ( SELECT count(*) + ( ( ( SELECT count(*) FROM flights ))) FROM
tickets titi)
>10))
ORDER
BY
f.aircraft_code ,
f.flight_no, ( ( ( SELECT max(airports.airport_code) FROM airports LIMIT
10
) )
)
DESC
offset
24
LIMIT ( ( (
SELECT count(*)
FROM airports )
))
+============================================================================================+
Query ID: 76fdfc62-548d-45b4-9af1-c073956987ad
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | f.* | a1 | selects everything |
| 2 | de41f8ea-fb8e-46c4-a8cb-5c3d8411291d | s | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT f.* AS a1, de41f8ea-fb8e-46c4-a8cb-5c3d8411291d AS s
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 0df54b2a-5b74-4779-8984-e687c8be7a19 | f | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM 0df54b2a-5b74-4779-8984-e687c8be7a19 AS f
========= JOIN =========
Type: inner
Source: aircrafts
Alias: air
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | 3!=3 | 2<>1 | and | 165fee4f-cb0d-4820-87c9-7868fc65f5c3 |
| 2 | 2>3 | 4<2 | and | 94043dc1-3987-46bb-b371-3b29d37b3669 |
| 3 | 94043dc1-3987-46bb-b371-3b29d37b3669 | 165fee4f-cb0d-4820-87c9-7868fc65f5c3 | or | dc072169-e350-4830-bfca-ba8c345cf3d9 |
| 4 | 1=1 | 1=1 | and | b996ee5d-e9c0-4f17-b358-787f47277528 |
| 5 | b996ee5d-e9c0-4f17-b358-787f47277528 | dc072169-e350-4830-bfca-ba8c345cf3d9 | or | 764ddafb-458e-46b4-ac55-4684580f36c1 |
| 6 | air.aircraft_code=f.aircraft_code | air.aircraft_code=f.aircraft_code | and | d48f3e7c-f9fc-41a8-a083-248879f0ee3e |
| 7 | d48f3e7c-f9fc-41a8-a083-248879f0ee3e | 764ddafb-458e-46b4-ac55-4684580f36c1 | or | 6092b28a-f6ee-49b1-877b-5f549e8cfa8a |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: INNER JOIN aircrafts AS air ON ((air.aircraft_code=f.aircraft_code and air.aircraft_code=f.aircraft_code) or ((1=1 and 1=1) or ((2>3 and 4<2) or (3!=3 and 2<>1))))
========= JOIN =========
Type: full outer
Source: aircrafts_data
Alias: ad
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | ad.aircraft_code=air.aircraft_code | — | — | 9f7be59a-aecf-44be-ba5c-23aa9ffd1637 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: FULL OUTER JOIN aircrafts_data AS ad ON ad.aircraft_code=air.aircraft_code
========= JOIN =========
Type: left
Source: airports_data
Alias: apd
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | apd.airport_code=f.aircraft_code | f.flight_id=10*10^2 | and | a7e0e0d3-42e1-4741-b1bd-45c66f0ade6e |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: LEFT JOIN airports_data AS apd ON apd.airport_code=f.aircraft_code and f.flight_id=10*10^2
========= WHERE =========
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | f.aircraft_code='asd' | f.aircraft_code='5454' | or | 9061ea69-fdf9-4e54-96e1-45052206d586 |
| 2 | 9061ea69-fdf9-4e54-96e1-45052206d586 | f.aircraft_code='2332' | and | c05e2413-56b6-4bd5-bb2f-db51fd711fca |
| 3 | c05e2413-56b6-4bd5-bb2f-db51fd711fca | 4bb8eb4f-2f1d-4e47-9e53-00a0aad4d77b>10 | or | 0a774577-6973-4eea-b771-fe6d00b040af |
| 4 | f.flight_no='a' | 0a774577-6973-4eea-b771-fe6d00b040af | and | 659f44bf-56a6-4d2e-8c6d-b4f5fc0d2836 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: WHERE (f.flight_no='a' and (((f.aircraft_code='asd' or f.aircraft_code='5454') and f.aircraft_code='2332') or 4bb8eb4f-2f1d-4e47-9e53-00a0aad4d77b>10))
========= ORDER BY =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | f.aircraft_code | no alias provided | column |
| 2 | f.flight_no | no alias provided | column |
| 3 | 066b0016-968f-482e-8abe-1fc99304d6c9 | no alias provided | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: ORDER BY f.aircraft_code, f.flight_no, 066b0016-968f-482e-8abe-1fc99304d6c9 DESC
========= LIMIT =========
The limit is represented by subquery. Watch eedb3650-b5fc-440c-9a5c-bbcc23f9b9f8 for more details
Restored part: LIMIT eedb3650-b5fc-440c-9a5c-bbcc23f9b9f8
========= OFFSET =========
The offset is 24
Restored part: OFFSET 24
+============================================================================================+
Query ID: 4bb8eb4f-2f1d-4e47-9e53-00a0aad4d77b
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | count(*)+(((356efa5b-bfd5-49bf-bda2-58224b739693))) | no alias provided | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT count(*)+(((356efa5b-bfd5-49bf-bda2-58224b739693)))
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | tickets | titi | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM tickets AS titi
+============================================================================================+
Query ID: de41f8ea-fb8e-46c4-a8cb-5c3d8411291d
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | sum(a.flight_id) | ss | function |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT sum(a.flight_id) AS ss
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | flights | a | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM flights AS a
========= GROUP BY =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | a.flight_id | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored: GROUP BY a.flight_id
+============================================================================================+
Query ID: 0df54b2a-5b74-4779-8984-e687c8be7a19
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | * | no alias provided | selects everything |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT *
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | flights | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM flights
+============================================================================================+
Query ID: 066b0016-968f-482e-8abe-1fc99304d6c9
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | max(airports.airport_code) | no alias provided | function |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT max(airports.airport_code)
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | airports | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM airports
========= LIMIT =========
The limit is 10
Restored part: LIMIT 10
+============================================================================================+
Query ID: eedb3650-b5fc-440c-9a5c-bbcc23f9b9f8
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | count(*) | no alias provided | function |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT count(*)
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | airports | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM airports
+============================================================================================+
Query ID: 356efa5b-bfd5-49bf-bda2-58224b739693
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | count(*) | no alias provided | function |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT count(*)
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | flights | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM flights
=========================
Restored query string:
SELECT f.* AS a1, (SELECT sum(a.flight_id) AS ss FROM flights AS a GROUP BY a.flight_id ) AS s
FROM (SELECT * FROM flights ) AS f
INNER JOIN aircrafts AS air ON ((air.aircraft_code=f.aircraft_code and air.aircraft_code=f.aircraft_code) or ((1=1 and 1=1) or ((2>3 and 4<2) or (3!=3 and 2<>1))))
FULL OUTER JOIN aircrafts_data AS ad ON ad.aircraft_code=air.aircraft_code
LEFT JOIN airports_data AS apd ON apd.airport_code=f.aircraft_code and f.flight_id=10*10^2
WHERE (f.flight_no='a' and (((f.aircraft_code='asd' or f.aircraft_code='5454') and f.aircraft_code='2332') or (SELECT count(*)+((((SELECT count(*) FROM flights )))) FROM tickets AS titi )>10))
ORDER BY f.aircraft_code, f.flight_no, (SELECT max(airports.airport_code) FROM airports LIMIT 10 ) DESC
LIMIT (SELECT count(*) FROM airports )
OFFSET 24
**********************************************************************************
QUERY TO PARSE:
select 1 alias
+============================================================================================+
Query ID: 306521ad-a305-4bd6-84ee-2d8cb6a8a19c
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 1 | alias | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 1 AS alias
=========================
Restored query string:
SELECT 1 AS alias
**********************************************************************************
QUERY TO PARSE:
select *
from flights f
left outer join flights_v fv on fv.flight_id = ((10) * 10 + 15 - 15) ^ 2
where f.flight_id = 10*10
+============================================================================================+
Query ID: a38c9209-08a5-434e-9648-e2f38db1db2d
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | * | no alias provided | selects everything |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT *
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | flights | f | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM flights AS f
========= JOIN =========
Type: left outer
Source: flights_v
Alias: fv
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | fv.flight_id=((10)*10+15-15)^2 | — | — | 81beb37f-e75c-4e5e-b5ca-28c449df0156 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: LEFT OUTER JOIN flights_v AS fv ON fv.flight_id=((10)*10+15-15)^2
========= WHERE =========
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | f.flight_id=10*10 | — | — | 3dbf471d-596b-42c3-9b59-c68cf17d9e70 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: WHERE f.flight_id=10*10
=========================
Restored query string:
SELECT *
FROM flights AS f
LEFT OUTER JOIN flights_v AS fv ON fv.flight_id=((10)*10+15-15)^2
WHERE f.flight_id=10*10
**********************************************************************************
QUERY TO PARSE:
select a.* as a, (select 1)"2323"
from airports a
left join airports_data ad on ad.airport_code = a.airport_code and ad.city is null
where ad.airport_code is NULL
+============================================================================================+
Query ID: 99fde50d-1a48-4fb4-bded-765befbca16c
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | a.* | a | selects everything |
| 2 | d1f03115-4ae1-4e91-bc65-e7139fbf5351 | "2323" | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT a.* AS a, d1f03115-4ae1-4e91-bc65-e7139fbf5351 AS "2323"
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | airports | a | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM airports AS a
========= JOIN =========
Type: left
Source: airports_data
Alias: ad
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | ad.airport_code=a.airport_code | ad.city is null | and | 6146171b-2eb5-4c78-880f-db2a09ccf5a4 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: LEFT JOIN airports_data AS ad ON ad.airport_code=a.airport_code and ad.city is null
========= WHERE =========
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | ad.airport_code is NULL | — | — | 9d3a46e6-7619-4c5d-985d-db2e0df14fa5 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: WHERE ad.airport_code is NULL
+============================================================================================+
Query ID: d1f03115-4ae1-4e91-bc65-e7139fbf5351
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 1 | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 1
=========================
Restored query string:
SELECT a.* AS a, (SELECT 1 ) AS "2323"
FROM airports AS a
LEFT JOIN airports_data AS ad ON ad.airport_code=a.airport_code and ad.city is null
WHERE ad.airport_code is NULL
**********************************************************************************
QUERY TO PARSE:
SELECT author.name, count(book.id), sum(book.cost)
FROM author
LEFT JOIN book ON (author.id = book.author_id)
GROUP BY author.name
HAVING COUNT(*) > 1 AND SUM(book.cost) > 500
LIMIT 10;
+============================================================================================+
Query ID: aacf9154-1326-43ab-9b8f-9965cdc57b1d
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | author.name | no alias provided | column |
| 2 | count(book.id) | no alias provided | function |
| 3 | sum(book.cost) | no alias provided | function |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT author.name, count(book.id), sum(book.cost)
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | author | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM author
========= JOIN =========
Type: left
Source: book
Alias: no alias provided
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | (author.id=book.author_id) | — | — | da4ad60b-9e7b-4b93-997a-56a320783821 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: LEFT JOIN book ON (author.id=book.author_id)
========= GROUP BY =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | author.name | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored: GROUP BY author.name
========= HAVING =========
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | COUNT(*)>1 | SUM(book.cost)>500 | and | d5337a7a-9d49-4370-bc17-b8e94d98ffe4 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: HAVING COUNT(*)>1 and SUM(book.cost)>500
========= LIMIT =========
The limit is 10;
Restored part: LIMIT 10;
=========================
Restored query string:
SELECT author.name, count(book.id), sum(book.cost)
FROM author
LEFT JOIN book ON (author.id=book.author_id)
GROUP BY author.name
HAVING COUNT(*)>1 and SUM(book.cost)>500
LIMIT 10;
**********************************************************************************
QUERY TO PARSE:
SELECT * FROM book
+============================================================================================+
Query ID: 2bee583f-ac86-4971-9d69-cd1543c90ee8
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | * | no alias provided | selects everything |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT *
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | book | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM book
=========================
Restored query string:
SELECT *
FROM book
**********************************************************************************
QUERY TO PARSE:
SeLeCt "f1".flight_id
fRoM flights as "f1"
inner join flights as f_2 on "f1".aircraft_code = f_2.aircraft_code
where "f1".flight_id between 10 and 100 and f_2.flight_id not in (1,2,3,4,5,6,7, (select 1), (select (select 2)))
group by "f1".flight_id
order by "f1".flight_id DESC
limit ((select count(*) alias_1 from flights limit all) + (select count(*) + 1 alias_2 from flights limit null))
offset (select 8)
+============================================================================================+
Query ID: ce91058e-52b5-4e15-a70e-bc3739f56e77
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | "f1".flight_id | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT "f1".flight_id
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | flights | "f1" | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM flights AS "f1"
========= JOIN =========
Type: inner
Source: flights
Alias: f_2
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | "f1".aircraft_code=f_2.aircraft_code | — | — | 99c5e886-943e-491c-8af9-c866831da281 |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: INNER JOIN flights AS f_2 ON "f1".aircraft_code=f_2.aircraft_code
========= WHERE =========
TABLE. Expression priority map
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| Priority | Left expression | Right expression | Operator | ID |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
| 1 | "f1".flight_id between 10 and 100 | f_2.flight_id not in (1,2,3,4,5,6,7,24b5a7be-102f-46bd-b549-c8854dde6e68,8a1cd763-5b89-42d7-9e3b-08967dabe793) | and | 615ed281-a8c4-4085-b37e-387f1cc1b43d |
+-----------+--------------------------------------------------------------+--------------------------------------------------------------+------------+------------------------------------------+
Restored part: WHERE "f1".flight_id between 10 and 100 and f_2.flight_id not in (1,2,3,4,5,6,7,24b5a7be-102f-46bd-b549-c8854dde6e68,8a1cd763-5b89-42d7-9e3b-08967dabe793)
========= GROUP BY =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | "f1".flight_id | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored: GROUP BY "f1".flight_id
========= ORDER BY =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | "f1".flight_id | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: ORDER BY "f1".flight_id DESC
========= LIMIT =========
The limit is represented by subquery. Watch ((b10ffd18-a03f-48cf-b29c-324bfe7ca65c)+(21fda21b-469b-4f3c-ab6d-f98a202232f3)) for more details
Restored part: LIMIT ((b10ffd18-a03f-48cf-b29c-324bfe7ca65c)+(21fda21b-469b-4f3c-ab6d-f98a202232f3))
========= OFFSET =========
The offset is represented by subquery. Watch 1f0c36ca-591d-4fd9-9451-2933c4712b2b for more details
Restored part: OFFSET 1f0c36ca-591d-4fd9-9451-2933c4712b2b
+============================================================================================+
Query ID: 8a1cd763-5b89-42d7-9e3b-08967dabe793
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | e06c4a5b-6126-4f17-af49-f5dc4e6188fb | no alias provided | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT e06c4a5b-6126-4f17-af49-f5dc4e6188fb
+============================================================================================+
Query ID: 24b5a7be-102f-46bd-b549-c8854dde6e68
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 1 | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 1
+============================================================================================+
Query ID: b10ffd18-a03f-48cf-b29c-324bfe7ca65c
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | count(*) | alias_1 | function |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT count(*) AS alias_1
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | flights | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM flights
========= LIMIT =========
The limit is all
Restored part: LIMIT all
+============================================================================================+
Query ID: 21fda21b-469b-4f3c-ab6d-f98a202232f3
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | count(*)+1 | alias_2 | function |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT count(*)+1 AS alias_2
========= FROM =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Source | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | flights | no alias provided | table/view |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: FROM flights
========= LIMIT =========
The limit is null
Restored part: LIMIT null
+============================================================================================+
Query ID: 1f0c36ca-591d-4fd9-9451-2933c4712b2b
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 8 | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 8
+============================================================================================+
Query ID: e06c4a5b-6126-4f17-af49-f5dc4e6188fb
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 2 | no alias provided | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 2
=========================
Restored query string:
SELECT "f1".flight_id
FROM flights AS "f1"
INNER JOIN flights AS f_2 ON "f1".aircraft_code=f_2.aircraft_code
WHERE "f1".flight_id between 10 and 100 and f_2.flight_id not in (1,2,3,4,5,6,7,(SELECT 1 ),(SELECT (SELECT 2 ) ))
GROUP BY "f1".flight_id
ORDER BY "f1".flight_id DESC
LIMIT (((SELECT count(*) AS alias_1 FROM flights LIMIT all ))+((SELECT count(*)+1 AS alias_2 FROM flights LIMIT null )))
OFFSET (SELECT 8 )
**********************************************************************************
QUERY TO PARSE:
select (select (select (select (select (select (select (select (select (select 1 a)b)c)d)e)f)g)h)i)k
+============================================================================================+
Query ID: 960210b0-3300-48b3-a4f0-61e564e27a2f
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | f8103f62-38d0-4601-bc2a-73ec3afc50e7 | k | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT f8103f62-38d0-4601-bc2a-73ec3afc50e7 AS k
+============================================================================================+
Query ID: f8103f62-38d0-4601-bc2a-73ec3afc50e7
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 3b9a05eb-1144-40c5-9a84-2204a34eb0b6 | i | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 3b9a05eb-1144-40c5-9a84-2204a34eb0b6 AS i
+============================================================================================+
Query ID: 3b9a05eb-1144-40c5-9a84-2204a34eb0b6
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 0eec32bd-1ee7-4767-a8b2-503614be67b5 | h | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 0eec32bd-1ee7-4767-a8b2-503614be67b5 AS h
+============================================================================================+
Query ID: 0eec32bd-1ee7-4767-a8b2-503614be67b5
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | b40c1023-7e0c-4371-9f73-04d019c14aed | g | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT b40c1023-7e0c-4371-9f73-04d019c14aed AS g
+============================================================================================+
Query ID: b40c1023-7e0c-4371-9f73-04d019c14aed
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | ed410271-e2e8-4f7d-acc5-d993cec32db6 | f | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT ed410271-e2e8-4f7d-acc5-d993cec32db6 AS f
+============================================================================================+
Query ID: ed410271-e2e8-4f7d-acc5-d993cec32db6
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 26b4e514-ea78-43c3-8ed7-aff3856c72f8 | e | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 26b4e514-ea78-43c3-8ed7-aff3856c72f8 AS e
+============================================================================================+
Query ID: 26b4e514-ea78-43c3-8ed7-aff3856c72f8
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | d8124b0e-4903-4adf-937e-4fe4be3e1fd0 | d | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT d8124b0e-4903-4adf-937e-4fe4be3e1fd0 AS d
+============================================================================================+
Query ID: d8124b0e-4903-4adf-937e-4fe4be3e1fd0
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 17ac2cdc-f6eb-4542-96aa-42319fb349dd | c | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 17ac2cdc-f6eb-4542-96aa-42319fb349dd AS c
+============================================================================================+
Query ID: 17ac2cdc-f6eb-4542-96aa-42319fb349dd
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 8cf88695-c632-4b7a-9dd6-3715da9bdcda | b | subquery |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 8cf88695-c632-4b7a-9dd6-3715da9bdcda AS b
+============================================================================================+
Query ID: 8cf88695-c632-4b7a-9dd6-3715da9bdcda
+--------------------------------------------------------------------------------------------+
========= SELECT =========
+-----+--------------------------------------------------------------+----------------------+------------------------+
| № | Value | Alias | Type |
+-----+--------------------------------------------------------------+----------------------+------------------------+
| 1 | 1 | a | column |
+-----+--------------------------------------------------------------+----------------------+------------------------+
Restored part: SELECT 1 AS a
=========================
Restored query string:
SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT 1 AS a ) AS b ) AS c ) AS d ) AS e ) AS f ) AS g ) AS h ) AS i ) AS k
**********************************************************************************