-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathsimple_parsing.txt
More file actions
484 lines (392 loc) · 17.7 KB
/
simple_parsing.txt
File metadata and controls
484 lines (392 loc) · 17.7 KB
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
// format:
// statement row1
// statement row2
// ...
// statement rown
// <empty line>
sELect g.*, A.K from B, KLJ as A
select * from TABLE_A;
select * from TABLE_A
select * from TABLE_A LIMIT 34
select * from TABLE_A LIMIT ?
select * from TABLE_A LIMIT 34,?
select * from TABLE_A LIMIT ?,?
select * from TABLE_A LIMIT ? OFFSET 3
select * from TABLE_A LIMIT ? OFFSET ?
select * from TABLE_A LIMIT ALL OFFSET ?
select * from TABLE_A LIMIT ALL OFFSET 3
select * from TABLE_A OFFSET 3
select A,sdf,sch.tab.col from TABLE_A;
select k, * from K as skldjfl where i=0
select MAX(k+2), COUNT(*), MYCOL from K
SELECT * FROM TA2 LEFT JOIN O USING (col1, col2)
where D.OasSD = 'asdf' And (kj >= 4 OR l < 'sdf')
seLECT my as KIO, lio aS
NE fRom TA2 LEFT OUter JOIN O as TA3
where D.OasSD = 'asdf' And (kj >= 4 OR l < 'sdf')
select * from a
INNer Join TAB_2 ON i.o = p.l whEre 'sdf'>'asdf' AND
(
OL<>?
OR
L NOT IN (SELECT * FROM KJSD)
)
select * from k where L IS NOT NUll;
(select sdf from sdfd) UNION (select * from k);
update mytab set jk=das, d=kasd+asd/d+3 where KL>= ds OR (k not in (SELECT K from KS));
insert into tabName VALUES ('sdgf', ?, ?)
insert into myschama.tabName2 (col1, col2, col3) VALUES ('sdgf', ?, ?)
delete from jk
delete from asdff where INI = 94 OR (ASD>9 AND (SELECT MAX(ID) from myt) > ?)
select * from ( SELECT intermediate.id as id , intermediate.date as
date FROM ( SELECT DISTINCT ON ( id ) * FROM ( SELECT
wct_workflows.workflow_id as id , wct_transaction.date as date FROM
wct_audit_entry , wct_transaction , wct_workflows WHERE
( wct_audit_entry.privilege = 'W' or wct_audit_entry.privilege =
'C' ) and wct_audit_entry.outcome = 't' and
wct_audit_entry.transaction_id = wct_transaction.transaction_id and
wct_transaction.user_id = 164 and wct_audit_entry.object_id =
wct_workflows.active_version_id)))
(select * from ( SELECT intermediate.id as id , intermediate.date as
date FROM ( SELECT DISTINCT ( id ) FROM ( SELECT
wct_workflows.workflow_id as id , wct_transaction.date as date FROM
wct_audit_entry , wct_transaction , wct_workflows WHERE
( wct_audit_entry.privilege = 'W' or wct_audit_entry.privilege =
'C' ) and wct_audit_entry.outcome = 't' and
wct_audit_entry.transaction_id = wct_transaction.transaction_id and
wct_transaction.user_id = 164 and wct_audit_entry.object_id =
wct_workflows.active_version_id)))) UNION ( SELECT wct_workflows.workflow_id as
id , wct_transaction.date as date FROM wct_audit_entry ,
wct_transaction , wct_workflows WHERE ( wct_audit_entry.privilege =
'W' or wct_audit_entry.privilege = 'C' ) and wct_audit_entry.outcome
= 't' and wct_audit_entry.transaction_id =
wct_transaction.transaction_id and wct_transaction.user_id = 164 and
p= 'asd')
select * from ( SELECT intermediate.id as id , intermediate.date as
date FROM ( SELECT DISTINCT ( id ) FROM ( SELECT
wct_workflows.workflow_id as id , wct_transaction.date as date FROM
wct_audit_entry , wct_transaction , wct_workflows WHERE
( wct_audit_entry.privilege = 'W' or wct_audit_entry.privilege =
'C' ) and wct_audit_entry.outcome = 't' and
wct_audit_entry.transaction_id = wct_transaction.transaction_id and
wct_transaction.user_id = 164 and wct_audit_entry.object_id =
wct_workflows.active_version_id ))) UNION SELECT wct_workflows.workflow_id as
id , wct_transaction.date as date FROM wct_audit_entry ,
wct_transaction , wct_workflows WHERE ( wct_audit_entry.privilege =
'W' or wct_audit_entry.privilege = 'C' ) and wct_audit_entry.outcome
= 't' and wct_audit_entry.transaction_id =
wct_transaction.transaction_id and wct_transaction.user_id = 164 and
afdf= ( select wct_audit_entry.object_id from wct_audit_entry ,
wct_workflow_archive where wct_audit_entry.object_id =
wct_workflow_archive.archive_id and wct_workflows.workflow_id =
wct_workflow_archive.workflow_id )
UNION SELECT wct_workflows.workflow_id
as id , wct_transaction.date as date FROM wct_audit_entry ,
wct_transaction , wct_workflows WHERE ( wct_audit_entry.privilege =
'W' OR wct_audit_entry.privilege = 'E' OR wct_audit_entry.privilege =
'A' ) and wct_audit_entry.outcome = 't' and
wct_audit_entry.transaction_id = wct_transaction.transaction_id and
wct_transaction.user_id = 164 and wct_audit_entry.object_id =
wct_workflows.workflow_id UNION SELECT * FROM interm2 , wct_workflow_docs WHERE
interm2.id = wct_workflow_docs.document_id ORDER BY id , date DESC
replace df set ki='oasdf', dsd=asd+dd
(select sdf from sdfd) UNION (select * from k) ORDER BY 1,2;
(select sdf from sdfd) UNION (select * from k) ORDER BY 1,asd.sd ;
(select sdf from sdfd) UNION (select * from k) UNION (select * from k2) LIMIT 0,2;
select sdf from sdfd UNION select * from k join j on k.p = asdf.f;
select * from ( select persistence_dynamic_ot.pdl_id ,
acs_objects.default_domain_class as attribute0 ,
acs_objects.object_type as attribute1 , acs_objects.display_name
as attribute2 , persistence_dynamic_ot.dynamic_object_type as
attribute3 , persistence_dynamic_ot.pdl_file as attribute4 from
persistence_dynamic_ot , acs_objects where
persistence_dynamic_ot.pdl_id = acs_objects.object_id )
SELECT * FROM table1 WHERE column1 > ALL (SELECT column2 FROM table1)
INSERT INTO mytable (col1, col2, col3) SELECT * FROM mytable2
insert into foo ( x ) select a from b
select (case when a > 0 then b + a else 0 end) p from mytable
SELECT BTI.*, BTI_PREDECESSOR.objid AS predecessor_objid, BTI_PREDECESSOR.item_id
AS predecessor_item_id, BTIT_PREDECESSOR.bt_item_type_key AS predecessor_type_key,
CAT.catalog_key, S.objid AS state_objid, S.state_key, S.is_init_state,
S.is_final_state, mlS.name AS state, BTIT.bt_item_type_key, BTP.bt_processor_key,
mlBTP.name AS bt_processor_name , CU.objid AS cust_user_objid , CU.title AS
cust_user_title , CU.firstname AS cust_user_firstname , CU.lastname AS
cust_user_lastname , CU.salutation2pv AS cust_user_salutation2pv , PV_CU.name_option
AS cust_user_salutation , A_CU.email AS cust_user_email , '' AS use_option_field,
'' AS use_readerlist , BTI_QUOTATION.quotation_type2pv , BTI_QUOTATION.is_mandatory
AS quotation_is_mandatory , BTI_QUOTATION.is_multiple AS quotation_is_multiple
, BTI_QUOTATION.expiration_datetime AS quotation_expiration_datetime ,
BTI_QUOTATION.hint_internal AS quotation_hint_internal , BTI_QUOTATION.hint_external
AS quotation_hint_external , BTI_QUOTATION.filter_value AS quotation_filter_value
, BTI_QUOTATION.email_cc AS quotation_email_cc , BTI_QUOTATION.notification1_datetime
AS notification1_datetime , BTI_QUOTATION.notification2_datetime AS
notification2_datetime , BTI_RFQ.filter_value AS request_for_quotation_filter_value
FROM tBusinessTransactionItem BTI LEFT OUTER JOIN tBusinessTransactionItem_Quotation
BTI_QUOTATION ON BTI_QUOTATION.this2business_transaction_item = BTI.objid LEFT
OUTER JOIN tBusinessTransactionItem_RequestForQuotation BTI_RFQ ON
BTI_RFQ.this2business_transaction_item = BTI.objid LEFT OUTER JOIN
tBusinessTransactionItem BTI_PREDECESSOR ON BTI_PREDECESSOR.objid
= BTI.predecessor2bt_item, tBusinessTransactionItemType BTIT_PREDECESSOR
, tBusinessTransactionItemType BTIT, tBusinessTransactionProcessor BTP,
mltBusinessTransactionProcessor mlBTP, tLanguagePriority LP_BTP, tState S, mltState
mlS, tLanguagePriority LP_S, tCatalog CAT
, tBusinessTransactionItem2BusinessTransaction BTI2BT ,
tBusinessTransactionItem2SessionCart BTI2SC , tSessionCart SC , tCustUser CU_MASTER
, tCustUser CU , tPopValue PV_CU , tAddress A_CU , tAddress2CustUser A2CU WHERE
BTI.objid <> -1 AND BTI_PREDECESSOR.this2bt_item_type = BTIT_PREDECESSOR.objid
AND BTI.this2bt_item_type = BTIT.objid AND BTI.this2bt_processor = BTP.objid
AND mlBTP.this2master = BTP.objid AND mlBTP.this2language = LP_BTP.item2language
AND LP_BTP.master2language = 0 AND LP_BTP.this2shop = 0 AND LP_BTP.priority
= (SELECT MIN(LP_BTP2.priority) FROM tLanguagePriority LP_BTP2,
mltBusinessTransactionProcessor mlBTP2 WHERE LP_BTP2.master2language = 0 AND
LP_BTP2.this2shop = 0 AND LP_BTP2.item2language = mlBTP2.this2language
AND mlBTP2.this2master = BTP.objid ) AND BTI.this2catalog = CAT.objid AND S.objid
= BTI.bt_item2state AND mlS.this2master = S.objid AND mlS.this2language
= LP_S.item2language AND LP_S.master2language = 0 AND LP_S.this2shop = 0 AND
LP_S.priority = (SELECT MIN(LP_S2.priority) FROM tLanguagePriority LP_S2, mltState
mlS2 WHERE LP_S2.master2language = 0 AND LP_S2.this2shop = 0 AND LP_S2.item2language
= mlS2.this2language AND mlS2.this2master = S.objid ) AND BTI.objid
= BTI2BT.this2business_transaction_item AND CU_MASTER.objid = 1101 AND
CU.this2customer = CU_MASTER.this2customer AND SC.this2custuser = CU.objid AND
BTI.objid = BTI2SC.this2business_transaction_item AND BTI.bt_item2state = 6664
AND BTI2SC.is_master_cart_item = 1 AND BTI2SC.this2session_cart = SC.objid AND
EXISTS (SELECT NULL FROM tBusinessTransaction BT, tBusinessTransactionType BTT
WHERE BT.objid = BTI2BT.this2business_transaction AND BTT.objid = BT.this2bt_type
AND BTT.business_transaction_type_key = 'order:master_cart') AND PV_CU.objid
= CU.salutation2pv AND A2CU.this2custuser = CU.objid AND A2CU.is_billing_default
= 1 AND A2CU.this2address = A_CU.objid ORDER BY BTI.dbobj_create_datetime DESC
WITH
DINFO (DEPTNO, AVGSALARY, EMPCOUNT) AS
(SELECT OTHERS.WORKDEPT, AVG(OTHERS.SALARY), COUNT(*)
FROM EMPLOYEE OTHERS
GROUP BY OTHERS.WORKDEPT
),
DINFOMAX AS
(SELECT MAX(AVGSALARY) AS AVGMAX FROM DINFO)
SELECT THIS_EMP.EMPNO, THIS_EMP.SALARY,
DINFO.AVGSALARY, DINFO.EMPCOUNT, DINFOMAX.AVGMAX
FROM EMPLOYEE THIS_EMP, DINFO, DINFOMAX
WHERE THIS_EMP.JOB = 'SALESREP'
AND THIS_EMP.WORKDEPT = DINFO.DEPTNO
select * from Person where deptname='it' AND NOT (age=24)
select * from unnest(array[4,5,6]) with ordinality;
SELECT * FROM tbl WHERE
day BETWEEN
CAST(CAST((NOW() + INTERVAL '-30 day') AS date) AS timestamptz)
AND
CAST(CAST((NOW() + INTERVAL '-1 day') AS date) AS timestamptz);
SELECT DATE_TRUNC('week',("schema"."tbl"."column" + INTERVAL '1 day')) FROM "schema"."tbl";
WITH
FUNCTION doubleup(x integer)
RETURNS integer
RETURN x * 2
SELECT doubleup(21);
WITH
FUNCTION doubleup(x integer)
RETURNS integer
RETURN x * 2,
FUNCTION doubleupplusone(x integer)
RETURNS integer
RETURN doubleup(x) + 1
SELECT doubleupplusone(21);
WITH
FUNCTION hello(name varchar)
RETURNS varchar
RETURN format('Hello %s!', 'name'),
FUNCTION bye(name varchar)
RETURNS varchar
RETURN format('Bye %s!', 'name')
SELECT hello('Finn') || ' and ' || bye('Joe');
WITH
FUNCTION takesArray(x array<double>)
RETURNS double
RETURN x[1] + x[2] + x[3]
SELECT takesArray(array[1.0, 2.0, 3.0]);
SELECT
id,
json_exists(
description,
'lax $.children[*]?(@ > 10)'
) AS children_above_ten
FROM customers;
SELECT
id,
json_exists(
description,
'strict $.children[2]?(@ > 10)'
UNKNOWN ON ERROR
) AS child_3_above_ten
FROM customers;
SELECT
id,
json_query(
description,
'lax $.children'
) AS children
FROM customers;
SELECT
id,
json_query(
description,
'lax $.children[*]'
WITHOUT ARRAY WRAPPER
NULL ON ERROR
) AS children
FROM customers;
SELECT
id,
json_query(
description,
'lax $.children[last]'
WITH ARRAY WRAPPER
) AS last_child
FROM customers;
SELECT
id,
json_query(
description,
'strict $.children[*]?(@ > 12)'
WITH ARRAY WRAPPER
EMPTY ARRAY ON EMPTY
) AS children
FROM customers;
SELECT
id,
json_query(description, 'strict $.comment' KEEP QUOTES) AS quoted_comment,
json_query(description, 'strict $.comment' OMIT QUOTES) AS unquoted_comment
FROM customers;
SELECT id, json_value(
description,
'lax $.comment'
RETURNING char(12)
) AS comment
FROM customers;
SELECT id, json_value(
description,
'lax $.children[0]'
RETURNING tinyint
) AS child
FROM customers;
SELECT id, json_value(
description,
'strict $.children[2]'
DEFAULT 'err' ON ERROR
) AS child
FROM customers;
SELECT id, json_value(
description,
'lax $.children[2]'
DEFAULT 'missing' ON EMPTY
) AS child
FROM customers;
SELECT
*
FROM
json_table(
'[
{"id":1,"name":"Africa","wikiDataId":"Q15"},
{"id":2,"name":"Americas","wikiDataId":"Q828"},
{"id":3,"name":"Asia","wikiDataId":"Q48"},
{"id":4,"name":"Europe","wikiDataId":"Q51"}
]',
'strict $' COLUMNS (
NESTED PATH 'strict $[*]' COLUMNS (
id integer PATH 'strict $.id',
name varchar PATH 'strict $.name',
wiki_data_id varchar PATH 'strict $."wikiDataId"'
)
)
);
SELECT
*
FROM
json_table(
'[
{"continent": "Asia", "countries": [
{"name": "Japan", "population": 125.7},
{"name": "Thailand", "population": 71.6}
]},
{"continent": "Europe", "countries": [
{"name": "France", "population": 67.4},
{"name": "Germany", "population": 83.2}
]}
]',
'lax $' COLUMNS (
NESTED PATH 'lax $[*]' COLUMNS (
continent varchar PATH 'lax $.continent',
NESTED PATH 'lax $.countries[*]' COLUMNS (
country varchar PATH 'lax $.name',
population double PATH 'lax $.population'
)
)
));
SELECT
*
FROM
JSON_TABLE(
'[]',
'lax $' AS "root_path"
COLUMNS(
a varchar(1) PATH 'lax "A"',
NESTED PATH 'lax $[*]' AS "nested_path"
COLUMNS (b varchar(1) PATH 'lax "B"'))
PLAN ("root_path" OUTER "nested_path")
);
SELECT
*
FROM
JSON_TABLE(
'[]',
'lax $' AS "root_path"
COLUMNS(
a varchar(1) PATH 'lax "A"',
NESTED PATH 'lax $[*]' AS "nested_path"
COLUMNS (b varchar(1) PATH 'lax "B"'))
PLAN ("root_path" INNER "nested_path")
);
SELECT json_array(true, 12e-1, 'text');
SELECT json_array(
'[ "text" ] ' FORMAT JSON,
X'5B0035005D00' FORMAT JSON ENCODING UTF16
);
SELECT json_array(
json_query('{"key" : [ "value" ]}', 'lax $.key')
);
SELECT json_array(
DATE '2001-01-31',
UUID '12151fd2-7586-11e9-8f9e-2a86e4085a59'
);
SELECT json_array();
SELECT json_array(true, null, 1);
SELECT json_array(true, null, 1 ABSENT ON NULL);
SELECT json_array(true, null, 1 NULL ON NULL);
SELECT json_array(true, 1 RETURNING VARCHAR(100));
SELECT json_array(true, 1 RETURNING VARBINARY);
SELECT json_array(true, 1 RETURNING VARBINARY FORMAT JSON ENCODING UTF8);
SELECT json_array(true, 1 RETURNING VARBINARY FORMAT JSON ENCODING UTF16);
SELECT json_array(true, 1 RETURNING VARBINARY FORMAT JSON ENCODING UTF32);
SELECT json_object('key1' : 1, 'key2' : true);
SELECT json_object(KEY 'key1' VALUE 1, KEY 'key2' VALUE true);
SELECT json_object('key1' VALUE 1, 'key2' VALUE true);
SELECT json_object('x' : true, 'y' : 12e-1, 'z' : 'text');
SELECT json_object(
'x' : '[ "text" ] ' FORMAT JSON,
'y' : X'5B0035005D00' FORMAT JSON ENCODING UTF16
);
SELECT json_object(
'x' : json_query('{"key" : [ "value" ]}', 'lax $.key')
);
SELECT json_object(
'x' : DATE '2001-01-31',
'y' : UUID '12151fd2-7586-11e9-8f9e-2a86e4085a59'
);
SELECT json_object();
SELECT json_object('x' : null, 'y' : 1);
SELECT json_object('x' : null, 'y' : 1 NULL ON NULL);
SELECT json_object('x' : null, 'y' : 1 ABSENT ON NULL);
SELECT json_object('x' : null, 'x' : 1 WITH UNIQUE KEYS);
SELECT json_object('x' : 1 RETURNING VARCHAR(100));
SELECT json_object('x' : 1 RETURNING VARBINARY);
SELECT json_object('x' : 1 RETURNING VARBINARY FORMAT JSON ENCODING UTF8);
SELECT json_object('x' : 1 RETURNING VARBINARY FORMAT JSON ENCODING UTF16);
SELECT json_object('x' : 1 RETURNING VARBINARY FORMAT JSON ENCODING UTF32);