-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathreplacementPatterns.csv
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 571.
574 lines (574 loc) · 43.6 KB
/
replacementPatterns.csv
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
To,Pattern,Replacement
oracle,"INSERT INTO @table (@columns) VALUES (@values1),(@values2)",<start_of_insert> INSERT INTO @table (@columns) VALUES (INTO @table <par_open>@columns<par_close> VALUES <par_open>@values1<par_close>\n INTO @table <par_open>@columns<par_close> VALUES <par_open>@values2<par_close>\n)
oracle,INTO @table <par_open>@columns<par_close> VALUES <par_open>INTO @table <par_open>@columns<par_close> VALUES,INTO @table <par_open>@columns<par_close> VALUES
oracle,<start_of_insert> @a INSERT INTO @table (@columns) VALUES (@b),INSERT ALL\n@bSELECT * FROM dual
oracle,<par_open>,(
oracle,<par_close>,)
oracle,EXCEPT,MINUS
oracle,"CONCAT(@a, @b, @c)","CONCAT(@a, CONCAT(@b, @c))"
oracle,"DATEADD(second,@seconds,@datetime)","(@date + NUMTODSINTERVAL(@seconds, 'second'))"
oracle,"DATEADD(minute,@minutes,@datetime)","(@date + NUMTODSINTERVAL(@minutes, 'minute'))"
oracle,"DATEADD(hour,@hours,@datetime)","(@date + NUMTODSINTERVAL(@hours, 'hour'))"
oracle,"DATEADD(d,@days,@date)","(@date + NUMTODSINTERVAL(@days, 'day'))"
oracle,"DATEADD(dd,@days,@date)","(@date + NUMTODSINTERVAL(@days, 'day'))"
oracle,"DATEADD(day,@days,@date)","(@date + NUMTODSINTERVAL(@days, 'day'))"
oracle,"DATEADD(month,@months,@date)","ADD_MONTHS(@date, @months)"
oracle,"DATEADD(mm,@months,@date)","ADD_MONTHS(@date, @months)"
oracle,"DATEADD(m,@months,@date)","ADD_MONTHS(@date, @months)"
oracle,"DATEADD(year,@years,@date)","ADD_MONTHS(@date, 12 * @years)"
oracle,"DATEADD(yyyy,@years,@date)","ADD_MONTHS(@date, 12 * @years)"
oracle,"DATEADD(yy,@years,@date)","ADD_MONTHS(@date, 12 * @years)"
oracle,"DATEDIFF(day,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
oracle,"DATEDIFF(dd,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
oracle,"DATEDIFF(d,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
oracle,"CONVERT(VARCHAR,@date,112)","TO_CHAR(@date, 'YYYYMMDD')"
oracle,GETDATE(),SYSDATE
oracle,+ '@a',|| '@a'
oracle,'@a' +,'@a' ||
oracle,CAST(@a AS varchar(@b)) +,CAST(@a AS varchar(@b)) ||
oracle,+ CAST(@a AS varchar(@b)),|| CAST(@a AS varchar(@b))
oracle,CAST(@a AS varchar) +,CAST(@a AS varchar) ||
oracle,+ CAST(@a AS varchar),|| CAST(@a AS varchar)
oracle,"CONVERT(DATE, @a)","TO_DATE(@a, 'YYYYMMDD')"
oracle,CAST(@a AS VARCHAR),TO_CHAR(@a)
oracle,"DATEFROMPARTS(@year,@month,@day)","TO_DATE(TO_CHAR(@year,'0000')||'-'||TO_CHAR(@month,'00')||'-'||TO_CHAR(@day,'00'), 'YYYY-MM-DD')"
oracle,"DATETIMEFROMPARTS(@year,@month,@day,@hour,@minute,@second,@ms)","TO_DATE(TO_CHAR(@year,'0000')||'-'||TO_CHAR(@month,'00')||'-'||TO_CHAR(@day,'00')||' '||TO_CHAR(@hour,'00')||':'||TO_CHAR(@minute,'00')||':'||TO_CHAR(@second,'00'), 'YYYY-MM-DD HH24:MI:SS')"
oracle,EOMONTH(@date),LAST_DAY(@date)
oracle,STDEV(@a),STDDEV(@a)
oracle,VAR(@a),VARIANCE(@a)
oracle,RAND(),DBMS_RANDOM.VALUE
oracle,CEILING(@a),CEIL(@a)
oracle,"HASHBYTES('MD5',@a)","DBMS_CRYPTO.HASH(@a,2)"
oracle,LEN(@a),LENGTH(@a)
oracle,"LEFT(@str,@chars)","SUBSTR(@str,0,@chars)"
oracle,"RIGHT(@str,@chars)","SUBSTR(@str,-@chars)"
oracle,"LOG(@expression,@base)","<L_O_G>(@base,@expression)"
oracle,LOG(@expression),"LOG(2.718281828459,@expression)"
oracle,<L_O_G>,LOG
oracle,LOG10(@expression),"LOG(10,@expression)"
oracle,"ISNULL(@a,@b)","NVL(@a,@b)"
oracle,ISNUMERIC(@a),"(LENGTH(TRIM(TRANSLATE(@a, ' +-.0123456789',' '))) IS NULL)"
oracle,COUNT_BIG(@a),COUNT(@a)
oracle,SQUARE(@a),((@a)*(@a))
oracle,PI(),3.141592654
oracle,NEWID(),SYS_GUID()
oracle,"CHARINDEX(@a,@b)","INSTR(@b,@a)"
oracle,SELECT @a WHERE @b;,SELECT @a FROM DUAL WHERE @b;
oracle,(SELECT @a WHERE @b),(SELECT @a FROM DUAL WHERE @b)
oracle,SELECT @a WHERE @b UNION,SELECT @a FROM DUAL WHERE @b UNION
oracle,SELECT @a;,SELECT @a FROM DUAL;
oracle,(SELECT @a),(SELECT @a FROM DUAL)
oracle,SELECT @a UNION,SELECT @a FROM DUAL UNION
oracle,FROM DUAL FROM DUAL, <dummy> FROM DUAL
oracle,FROM @a UNION @b FROM DUAL UNION,FROM @a UNION @b FROM DUAL FROM DUAL UNION
oracle,FROM @a FROM DUAL UNION,FROM @a UNION
oracle,FROM @a UNION @b FROM DUAL;,FROM @a UNION @b FROM DUAL FROM DUAL;
oracle,FROM @a FROM DUAL;,FROM @a;
oracle,FROM @a UNION @b FROM DUAL WHERE,FROM @a UNION @b FROM DUAL FROM DUAL WHERE
oracle,FROM @a FROM DUAL WHERE,FROM @a WHERE
oracle,FROM @a UNION @b FROM DUAL),FROM @a UNION @b FROM DUAL FROM DUAL)
oracle,FROM @b FROM DUAL),FROM @b)
oracle,<dummy>,
oracle,SELECT @a CASE @b COUNT(@c) @d END @e;,SELECT @a CASE @b COUNT(@c) @d END @e GROUP BY 1;
oracle,(SELECT @a CASE @b COUNT(@c) @d END @e),(SELECT @a CASE @b COUNT(@c) @d END @e GROUP BY 1)
oracle,GROUP BY @a GROUP BY 1,GROUP BY @a
oracle,GROUP BY @a GROUP BY 1,GROUP BY @a
oracle,YEAR(@date),EXTRACT(YEAR FROM @date)
oracle,MONTH(@date),EXTRACT(MONTH FROM @date)
oracle,DAY(@date),EXTRACT(DAY FROM @date)
oracle,"IF OBJECT_ID('@table', 'U') IS NULL CREATE TABLE @table (@definition);",BEGIN\n EXECUTE IMMEDIATE 'CREATE TABLE @table (@definition)';\nEXCEPTION\n WHEN OTHERS THEN\n IF SQLCODE != -955 THEN\n RAISE;\n END IF;\nEND;
oracle,"IF OBJECT_ID('tempdb..#@table', 'U') IS NOT NULL DROP TABLE #@table;",BEGIN\n EXECUTE IMMEDIATE 'TRUNCATE TABLE %temp_prefix%%session_id%@table';\n EXECUTE IMMEDIATE 'DROP TABLE %temp_prefix%%session_id%@table';\nEXCEPTION\n WHEN OTHERS THEN\n IF SQLCODE != -942 THEN\n RAISE;\n END IF;\nEND;
oracle,"IF OBJECT_ID('@table', 'U') IS NOT NULL DROP TABLE @table;",BEGIN\n EXECUTE IMMEDIATE 'TRUNCATE TABLE @table';\n EXECUTE IMMEDIATE 'DROP TABLE @table';\nEXCEPTION\n WHEN OTHERS THEN\n IF SQLCODE != -942 THEN\n RAISE;\n END IF;\nEND;
oracle,USE @schema;,ALTER SESSION SET current_schema = @schema;
oracle,.dbo.,.
oracle,CREATE CLUSTERED INDEX,CREATE INDEX
oracle,CREATE UNIQUE INDEX @name ON @table (@variable);,BEGIN\n EXECUTE IMMEDIATE 'CREATE UNIQUE INDEX @name ON @table (@variable)';\nEXCEPTION\n WHEN OTHERS THEN\n IF SQLCODE != -1408 THEN\n RAISE;\n END IF;\nEND;
oracle,CREATE UNIQUE CLUSTERED INDEX @name ON @table (@variable);,BEGIN\n EXECUTE IMMEDIATE 'CREATE UNIQUE INDEX @name ON @table (@variable)';\nEXCEPTION\n WHEN OTHERS THEN\n IF SQLCODE != -1408 THEN\n RAISE;\n END IF;\nEND;
oracle,PRIMARY KEY NONCLUSTERED,PRIMARY KEY
oracle,DATETIME,TIMESTAMP
oracle,BIGINT,NUMBER(19)
oracle,VARCHAR(MAX),CLOB
oracle,WITH @a AS @b SELECT @c INTO @d FROM @e;,CREATE TABLE @d\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
oracle,WITH @a AS @b INSERT INTO @c SELECT @d;,INSERT INTO @c WITH @a AS @b SELECT @d;
oracle,SELECT @a INTO @b FROM @c;,CREATE TABLE @b AS\nSELECT\n@a\nFROM\n@c;
oracle,SELECT @a INTO @b;,CREATE TABLE @b AS\nSELECT\n@a;
oracle,##,<hash><hash>
oracle,#,%temp_prefix%%session_id%
oracle,<hash><hash>,##
oracle,SELECT TOP @([0-9]+)rows @a;,SELECT @a WHERE ROWNUM <= @rows;
oracle,(SELECT TOP @([0-9]+)rows @a),(SELECT @a WHERE ROWNUM <= @rows)
oracle,SELECT @a WHERE @b WHERE ROWNUM <= @rows;,SELECT @a WHERE @b AND ROWNUM <= @rows;
oracle,(SELECT @a WHERE @b WHERE ROWNUM <= @rows),(SELECT @a WHERE @b AND ROWNUM <= @rows)
postgresql,"ROUND(@a,@b)","ROUND(CAST(@a AS NUMERIC),@b)"
postgresql,"CONVERT(DATE, @a)","TO_DATE(@a, 'yyyymmdd')"
postgresql,"DATEADD(second,@seconds,@datetime)",(@datetime + @seconds*INTERVAL'1 second')
postgresql,"DATEADD(minute,@minutes,@datetime)",(@datetime + @minutes*INTERVAL'1 minute')
postgresql,"DATEADD(hour,@hours,@datetime)",(@datetime + @hours*INTERVAL'1 hour')
postgresql,"DATEADD(d,@days,@date)",(@date + @days*INTERVAL'1 day')
postgresql,"DATEADD(dd,@days,@date)",(@date + @days*INTERVAL'1 day')
postgresql,"DATEADD(day,@days,@date)",(@date + @days*INTERVAL'1 day')
postgresql,"DATEADD(m,@months,@date)",(@date + @months*INTERVAL'1 month')
postgresql,"DATEADD(mm,@months,@date)",(@date + @months*INTERVAL'1 month')
postgresql,"DATEADD(month,@months,@date)",(@date + @months*INTERVAL'1 month')
postgresql,"DATEADD(yy,@years,@date)",(@date + @years*INTERVAL'1 year')
postgresql,"DATEADD(yyyy,@years,@date)",(@date + @years*INTERVAL'1 year')
postgresql,"DATEADD(year,@years,@date)",(@date + @years*INTERVAL'1 year')
postgresql,"DATEDIFF(d,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
postgresql,"DATEDIFF(dd,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
postgresql,"DATEDIFF(day,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
postgresql,"CONVERT(VARCHAR,@date,112)","TO_CHAR(@date, 'YYYYMMDD')"
postgresql,GETDATE(),CURRENT_DATE
postgresql,+ '@a',|| '@a'
postgresql,'@a' +,'@a' ||
postgresql,CAST(@a AS varchar(@b)) +,CAST(@a AS varchar(@b)) ||
postgresql,+ CAST(@a AS varchar(@b)),|| CAST(@a AS varchar(@b))
postgresql,CAST(@a AS varchar) +,CAST(@a AS varchar) ||
postgresql,+ CAST(@a AS varchar),|| CAST(@a AS varchar)
postgresql,"DATEFROMPARTS(@year,@month,@day)","TO_DATE(TO_CHAR(@year,'0000')||'-'||TO_CHAR(@month,'00')||'-'||TO_CHAR(@day,'00'), 'YYYY-MM-DD')"
postgresql,"DATETIMEFROMPARTS(@year,@month,@day,@hour,@minute,@second,@ms)","TO_DATE(TO_CHAR(@year,'0000')||'-'||TO_CHAR(@month,'00')||'-'||TO_CHAR(@day,'00')||' '||TO_CHAR(@hour,'00')||':'||TO_CHAR(@minute,'00')||':'||TO_CHAR(@second,'00'), 'YYYY-MM-DD HH24:MI:SS')"
postgresql,YEAR(@date),EXTRACT(YEAR FROM @date)
postgresql,MONTH(@date),EXTRACT(MONTH FROM @date)
postgresql,DAY(@date),EXTRACT(DAY FROM @date)
postgresql,EOMONTH(@date),"(DATE_TRUNC('MONTH', @date) + INTERVAL '1 MONTH - 1 day')::DATE"
postgresql,STDEV(@a),STDDEV(@a)
postgresql,VAR(@a),VARIANCE(@a)
postgresql,RAND(),RANDOM()
postgresql,"HASHBYTES('MD5',@a)",MD5(@a)
postgresql,LEN(@a),CHAR_LENGTH(@a)
postgresql,"CHARINDEX(@a,@b)","STRPOS(@b,@a)"
postgresql,"LOG(@expression,@base)","<L_O_G>(CAST((@base) AS NUMERIC),CAST((@expression) AS NUMERIC))"
postgresql,LOG(@expression),LN(CAST((@expression) AS REAL))
postgresql,<L_O_G>,LOG
postgresql,LOG10(@expression),"LOG(10,CAST((@expression) AS NUMERIC))"
postgresql,"ISNULL(@a,@b)","COALESCE(@a,@b)"
postgresql,ISNUMERIC(@a),(@a ~ '^([0-9]+\.?[0-9]*|\.[0-9]+)$')
postgresql,COUNT_BIG(@a),COUNT(@a)
postgresql,SQUARE(@a),((@a)*(@a))
postgresql,NEWID(),MD5(RANDOM()::TEXT || CLOCK_TIMESTAMP()::TEXT)
postgresql,USE @schema;,SET search_path TO @schema;
postgresql,"IF OBJECT_ID('@table', 'U') IS NULL CREATE TABLE @table (@definition);",CREATE TABLE IF NOT EXISTS @table (@definition);
postgresql,"IF OBJECT_ID('@table', 'U') IS NOT NULL DROP TABLE @table;",DROP TABLE IF EXISTS @table;
postgresql,"IF OBJECT_ID('tempdb..#@table', 'U') IS NOT NULL DROP TABLE @table;",DROP TABLE IF EXISTS @table;
postgresql,.dbo.,.
postgresql,CREATE TABLE #@table (@definition),CREATE TEMP TABLE @table (@definition)
postgresql,CREATE CLUSTERED INDEX @index_name ON @table (@variable);,CREATE INDEX @index_name ON @table (@variable);\nCLUSTER @table USING @index_name;
postgresql,CREATE UNIQUE CLUSTERED INDEX @index_name ON @table (@variable);,CREATE UNIQUE INDEX @index_name ON @table (@variable);\nCLUSTER @table USING @index_name;
postgresql,PRIMARY KEY NONCLUSTERED,PRIMARY KEY
postgresql,DATETIME,TIMESTAMP
postgresql,VARCHAR(MAX),TEXT
postgresql,FLOAT,NUMERIC
postgresql,WITH @a AS @b SELECT @c INTO #@d FROM @e;,CREATE TEMP TABLE @d\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;\nANALYZE @d;
postgresql,WITH @a AS @b SELECT @c INTO @d FROM @e;,CREATE TABLE @d\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
postgresql,SELECT @a INTO #@b FROM @c;,CREATE TEMP TABLE @b\nAS\nSELECT\n@a\nFROM\n@c;\nANALYZE @b;
postgresql,SELECT @a INTO @b FROM @c;,CREATE TABLE @b AS\nSELECT\n@a\nFROM\n@c;
postgresql,SELECT @a INTO @b;,CREATE TABLE @b AS\nSELECT\n@a;
postgresql,#,
postgresql,SELECT TOP @([0-9]+)rows @a;,SELECT @a LIMIT @rows;
postgresql,(SELECT TOP @([0-9]+)rows @a),(SELECT @a LIMIT @rows)
postgresql,"WITH @cte AS (SELECT @s1 '@literal' @s2)","WITH @cte AS (SELECT @s1 CAST('@literal' as TEXT) @s2)"
redshift,"OVER (@a ORDER BY @b DESC)","OVER (@a O*D*R B* @b DESC ROWS UNBOUNDED PRECEDING)"
redshift,"OVER (@a ORDER BY @b ASC)","OVER (@a O*D*R B* @b ASC ROWS UNBOUNDED PRECEDING)"
redshift,"OVER (@a ORDER BY @((?!.*ROWS).*)b)","OVER (@a O*D*R B* @b ROWS UNBOUNDED PRECEDING)"
redshift,"ROW_NUMBER() OVER (@a ROWS UNBOUNDED PRECEDING)","ROW_NUMBER() OVER (@a)"
redshift,"CUME_DIST() OVER (@a ROWS UNBOUNDED PRECEDING)","CUME_DIST() OVER (@a)"
redshift,"DENSE_RANK() OVER (@a ROWS UNBOUNDED PRECEDING)","DENSE_RANK() OVER (@a)"
redshift,"PERCENT_RANK() OVER (@a ROWS UNBOUNDED PRECEDING)","PERCENT_RANK() OVER (@a)"
redshift,"RANK() OVER (@a ROWS UNBOUNDED PRECEDING)","RANK() OVER (@a)"
redshift,"LAG(@x) OVER (@a ROWS UNBOUNDED PRECEDING)","LAG(@x) OVER (@a)"
redshift,"LEAD(@x) OVER (@a ROWS UNBOUNDED PRECEDING)","LEAD(@x) OVER (@a)"
redshift,"NTILE(@x) OVER (@a ROWS UNBOUNDED PRECEDING)","NTILE(@x) OVER (@a)"
redshift,"O*D*R B*","ORDER BY"
redshift,"ROUND(@a,@b)","ROUND(CAST(@a AS FLOAT),@b)"
redshift,"ROUND(@expression,@length,@trunc)","case when @trunc = 0 then ROUND(@expression,@length) else TRUNC(@expression,@length) end"
redshift,"DATEADD(dd,@days,@date)","DATEADD(day,@days,@date)"
redshift,"DATEADD(m,@months,@date)","DATEADD(month,@months,@date)"
redshift,"DATEADD(mm,@months,@date)","DATEADD(month,@months,@date)"
redshift,"DATEADD(yyyy,@years,@date)","DATEADD(year,@years,@date)"
redshift,"DATEADD(yy,@years,@date)","DATEADD(year,@years,@date)"
redshift,"DATEADD(qq,@n,@date)","DATEADD(quarter,@n,@date)"
redshift,"DATEADD(q,@n,@date)","DATEADD(quarter,@n,@date)"
redshift,"DATEADD(wk,@n,@date)","DATEADD(week,@n,@date)"
redshift,"DATEADD(ww,@n,@date)","DATEADD(week,@n,@date)"
redshift,"DATEADD(hh,@n,@date)","DATEADD(hour,@n,@date)"
redshift,"DATEADD(mi,@n,@date)","DATEADD(minute,@n,@date)"
redshift,"DATEADD(n,@n,@date)","DATEADD(minute,@n,@date)"
redshift,"DATEADD(ss,@n,@date)","DATEADD(second,@n,@date)"
redshift,"DATEADD(mcs,@n,@date)","DATEADD(microsecond,@n,@date)"
redshift,"DATEADD(@part,@n,@date)","DATEADD(@part,CAST(@n as int),@date)"
redshift,"DATEDIFF(dd,@start,@end)","DATEDIFF(day,@start,@end)"
redshift,"DATEDIFF(m,@start,@end)","DATEDIFF(month,@start,@end)"
redshift,"DATEDIFF(mm,@start,@end)","DATEDIFF(month,@start,@end)"
redshift,"DATEDIFF(yyyy,@start,@end)","DATEDIFF(year,@start,@end)"
redshift,"DATEDIFF(yy,@start,@end)","DATEDIFF(year,@start,@end)"
redshift,"DATEDIFF(qq,@start,@end)","DATEDIFF(quarter,@start,@end)"
redshift,"DATEDIFF(q,@start,@end)","DATEDIFF(quarter,@start,@end)"
redshift,"DATEDIFF(wk,@start,@end)","DATEDIFF(week,@start,@end)"
redshift,"DATEDIFF(ww,@start,@end)","DATEDIFF(week,@start,@end)"
redshift,"DATEDIFF(hh,@start,@end)","DATEDIFF(hour,@start,@end)"
redshift,"DATEDIFF(mi,@start,@end)","DATEDIFF(minute,@start,@end)"
redshift,"DATEDIFF(n,@start,@end)","DATEDIFF(minute,@start,@end)"
redshift,"DATEDIFF(ss,@start,@end)","DATEDIFF(second,@start,@end)"
redshift,"DATEDIFF(mcs,@start,@end)","DATEDIFF(microsecond,@start,@end)"
redshift,"DATEDIFF_BIG(dd,@start,@end)","DATEDIFF(day,@start,@end)"
redshift,"DATEDIFF_BIG(m,@start,@end)","DATEDIFF(month,@start,@end)"
redshift,"DATEDIFF_BIG(mm,@start,@end)","DATEDIFF(month,@start,@end)"
redshift,"DATEDIFF_BIG(yyyy,@start,@end)","DATEDIFF(year,@start,@end)"
redshift,"DATEDIFF_BIG(yy,@start,@end)","DATEDIFF(year,@start,@end)"
redshift,"DATEDIFF_BIG(qq,@start,@end)","DATEDIFF(quarter,@start,@end)"
redshift,"DATEDIFF_BIG(q,@start,@end)","DATEDIFF(quarter,@start,@end)"
redshift,"DATEDIFF_BIG(wk,@start,@end)","DATEDIFF(week,@start,@end)"
redshift,"DATEDIFF_BIG(ww,@start,@end)","DATEDIFF(week,@start,@end)"
redshift,"DATEDIFF_BIG(hh,@start,@end)","DATEDIFF(hour,@start,@end)"
redshift,"DATEDIFF_BIG(mi,@start,@end)","DATEDIFF(minute,@start,@end)"
redshift,"DATEDIFF_BIG(n,@start,@end)","DATEDIFF(minute,@start,@end)"
redshift,"DATEDIFF_BIG(ss,@start,@end)","DATEDIFF(second,@start,@end)"
redshift,"DATEDIFF_BIG(mcs,@start,@end)","DATEDIFF(microsecond,@start,@end)"
redshift,"DATEPART(dd,@date)","DATEPART(day,@date)"
redshift,"DATEPART(m,@date)","DATEPART(month,@date)"
redshift,"DATEPART(mm,@date)","DATEPART(month,@date)"
redshift,"DATEPART(yyyy,@date)","DATEPART(year,@date)"
redshift,"DATEPART(yy,@date)","DATEPART(year,@date)"
redshift,"DATEPART(qq,@date)","DATEPART(quarter,@date)"
redshift,"DATEPART(q,@date)","DATEPART(quarter,@date)"
redshift,"DATEPART(wk,@date)","DATEPART(week,@date)"
redshift,"DATEPART(ww,@date)","DATEPART(week,@date)"
redshift,"DATEPART(hh,@date)","DATEPART(hour,@date)"
redshift,"DATEPART(mi,@date)","DATEPART(minute,@date)"
redshift,"DATEPART(n,@date)","DATEPART(minute,@date)"
redshift,"DATEPART(ss,@date)","DATEPART(second,@date)"
redshift,"DATEPART(mcs,@date)","DATEPART(microsecond,@date)"
redshift,"CONVERT(VARCHAR,@date,112)","TO_CHAR(@date, 'YYYYMMDD')"
redshift,GETDATE(),CURRENT_DATE
redshift,+ '@a',|| '@a'
redshift,'@a' +,'@a' ||
redshift,CAST(@a AS varchar(@b)) +,CAST(@a AS varchar(@b)) ||
redshift,+ CAST(@a AS varchar(@b)),|| CAST(@a AS varchar(@b))
redshift,CAST(@a AS varchar) +,CAST(@a AS varchar) ||
redshift,+ CAST(@a AS varchar),|| CAST(@a AS varchar)
redshift,"DATEFROMPARTS(@year,@month,@day)","TO_DATE(TO_CHAR(@year,'0000FM')||'-'||TO_CHAR(@month,'00FM')||'-'||TO_CHAR(@day,'00FM'), 'YYYY-MM-DD')"
redshift,"DATETIMEFROMPARTS(@year,@month,@day,@hour,@minute,@second,@ms)","CAST(TO_CHAR(@year,'0000FM')||'-'||TO_CHAR(@month,'00FM')||'-'||TO_CHAR(@day,'00FM')||' '||TO_CHAR(@hour,'00FM')||':'||TO_CHAR(@minute,'00FM')||':'||TO_CHAR(@second,'00FM')||'.'||TO_CHAR(@ms,'000FM') as TIMESTAMP)"
redshift,YEAR(@date),EXTRACT(YEAR FROM @date)
redshift,MONTH(@date),EXTRACT(MONTH FROM @date)
redshift,DAY(@date),EXTRACT(DAY FROM @date)
redshift,EOMONTH(@date),LAST_DAY(@date)
redshift,VAR(@a),VARIANCE(@a)
redshift,STDEV(@a),STDDEV(@a)
redshift,RAND(),RANDOM()
redshift,"HASHBYTES('MD5',@a)",MD5(@a)
redshift,LEN(@a),CHAR_LENGTH(@a)
redshift,"LOG(@expression,@base)",(LN(CAST((@expression) AS REAL))/LN(CAST((@base) AS REAL)))
redshift,LOG(@expression),LN(CAST((@expression) AS REAL))
redshift,LOG10(@expression),LOG(CAST((@expression) AS REAL))
redshift,"ISNULL(@a,@b)","COALESCE(@a,@b)"
redshift,COUNT_BIG(@a),COUNT(@a)
redshift,SQUARE(@a),((@a) * (@a))
redshift,TEXT,VARCHAR(max)
redshift,NTEXT,VARCHAR(max)
redshift,NEWID(),MD5(RANDOM()::TEXT || GETDATE()::TEXT)
redshift,USE @schema;,SET search_path TO @schema;
redshift,"IF OBJECT_ID('@table', 'U') IS NULL CREATE TABLE @table (@definition);",CREATE TABLE IF NOT EXISTS @table (@definition);
redshift,"IF OBJECT_ID('@table', 'U') IS NOT NULL DROP TABLE @table;",DROP TABLE IF EXISTS @table;
redshift,"IF OBJECT_ID('tempdb..#@table', 'U') IS NOT NULL DROP TABLE @table;","DROP TABLE IF EXISTS #@table;"
redshift,.dbo.,.
redshift,"HINT DISTRIBUTE_ON_KEY(@key) @hint CREATE TABLE @table (@definition);",HINT DISTRIBUTE_ON_KEY(@key) @hint\nCREATE TABLE @table (@definition)\nDISTKEY(@key);
redshift,"HINT DISTRIBUTE_ON_RANDOM @hint CREATE TABLE @table (@definition);",HINT DISTRIBUTE_ON_RANDOM @hint\nCREATE TABLE @table (@definition)\nDISTSTYLE EVEN;
redshift,"HINT @hint SORT_ON_KEY(@type:@key) CREATE TABLE @table (@definition) @options;",HINT @hint SORT_ON_KEY(@type:@key)\nCREATE TABLE @table (@definition)\n@options\n@type SORTKEY(@key);
redshift,"CREATE TABLE @table (@a1 person_id @a2);",CREATE TABLE @table (@a1 person_id @a2)\nDISTKEY(person_id);
redshift,"CREATE TABLE @table (@a1 subject_id @a2);",CREATE TABLE @table (@a1 subject_id @a2)\nDISTKEY(subject_id);
redshift,"CREATE TABLE @table (@a1 analysis_id @a2);",CREATE TABLE @table (@a1 analysis_id @a2)\nDISTKEY(analysis_id);
redshift,"CREATE TABLE @table (@definition);",CREATE TABLE @table (@definition)\nDISTSTYLE ALL;
redshift,HINT DISTRIBUTE_ON_KEY(@key) WITH @a AS @b SELECT @c INTO @d FROM @e;,HINT DISTRIBUTE_ON_KEY(@key)\nCREATE TABLE @d\nDISTKEY(@key)\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
redshift,HINT DISTRIBUTE_ON_RANDOM WITH @a AS @b SELECT @c INTO @d FROM @e;,HINT DISTRIBUTE_ON_RANDOM\nCREATE TABLE @d\nDISTSTYLE EVEN\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
redshift,HINT SORT_ON_KEY(@type:@sortkey) WITH @a AS @b SELECT @c INTO @d FROM @e;,HINT SORT_ON_KEY(@type:@sortkey)\nCREATE TABLE @d\n@type SORTKEY(@sortkey)\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
redshift,HINT DISTRIBUTE_ON_KEY(@key) SORT_ON_KEY(@type:@sortkey) WITH @a AS @b SELECT @c INTO @d FROM @e;,HINT DISTRIBUTE_ON_KEY(@key) SORT_ON_KEY(@type:@sortkey)\nCREATE TABLE @d\nDISTKEY(@key)\n@type SORTKEY(@sortkey)\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
redshift,HINT DISTRIBUTE_ON_RANDOM SORT_ON_KEY(@type:@sortkey) WITH @a AS @b SELECT @c INTO @d FROM @e;,HINT DISTRIBUTE_ON_RANDOM SORT_ON_KEY(@type:@sortkey)\nCREATE TABLE @d\nDISTSTYLE EVEN\n@type SORTKEY(@sortkey)\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 person_id as @(\w+\b)key @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(@key)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 person_id as @key @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 person_id @(\w+\b)key @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(@key)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 person_id @key @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 person_id @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(person_id)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 person_id @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 subject_id as @(\w+\b)key @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(@key)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 subject_id as @key @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 subject_id @(\w+\b)key @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(@key)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 subject_id @key @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 subject_id @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(subject_id)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 subject_id @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 analysis_id as @(\w+\b)key @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(@key)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 analysis_id as @key @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 analysis_id @(\w+\b)key @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(@key)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 analysis_id @key @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c1 analysis_id @c2 INTO @d FROM @e;,CREATE TABLE @d\nDISTKEY(analysis_id)\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c1 analysis_id @c2\nFROM\n@e;
redshift,WITH @a AS @b SELECT @c INTO @d FROM @e;,CREATE TABLE @d DISTSTYLE ALL\nAS\nWITH\n@a\nAS\n@b\nSELECT\n@c\nFROM\n@e;
redshift,HINT DISTRIBUTE_ON_KEY(@key) SELECT @a INTO @b FROM @c;,HINT DISTRIBUTE_ON_KEY(@key) \nCREATE TABLE @b\nDISTKEY(@key)\nAS\nSELECT\n@a\nFROM\n@c;
redshift,HINT DISTRIBUTE_ON_RANDOM SELECT @a INTO @b FROM @c;,HINT DISTRIBUTE_ON_RANDOM \nCREATE TABLE @b\nDISTSTYLE EVEN\nAS\nSELECT\n@a\nFROM\n@c;
redshift,HINT SORT_ON_KEY(@type:@sortkey) SELECT @a INTO @b FROM @c;,HINT SORT_ON_KEY(@type:@sortkey)\nCREATE TABLE @b\n@type SORTKEY(@sortkey)\nAS\nSELECT\n@a\nFROM\n@c;
redshift,HINT DISTRIBUTE_ON_KEY(@key) SORT_ON_KEY(@type:@sortkey) SELECT @a INTO @b FROM @c;,HINT DISTRIBUTE_ON_KEY(@key) SORT_ON_KEY(@type:@sortkey)\nCREATE TABLE @b\nDISTKEY(@key)\n@type SORTKEY(@sortkey)\nAS\nSELECT\n@a\nFROM\n@c;
redshift,HINT DISTRIBUTE_ON_RANDOM SORT_ON_KEY(@type:@sortkey) SELECT @a INTO @b FROM @c;,HINT DISTRIBUTE_ON_RANDOM SORT_ON_KEY(@type:@sortkey)\nCREATE TABLE @b\nDISTSTYLE EVEN\n@type SORTKEY(@sortkey)\nAS\nSELECT\n@a\nFROM\n@c;
redshift,SELECT @a1 person_id as @(\w+\b)key @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(@key)\nAS\nSELECT\n@a1 person_id as @key @a2\nFROM\n@c;
redshift,SELECT @a1 person_id @(\w+\b)key @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(@key)\nAS\nSELECT\n@a1 person_id @key @a2\nFROM\n@c;
redshift,SELECT @a1 person_id @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(person_id)\nAS\nSELECT\n@a1 person_id @a2\nFROM\n@c;
redshift,SELECT @a1 subject_id as @(\w+\b)key @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(@key)\nAS\nSELECT\n@a1 subject_id as @key @a2\nFROM\n@c;
redshift,SELECT @a1 subject_id @(\w+\b)key @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(@key)\nAS\nSELECT\n@a1 subject_id @key @a2\nFROM\n@c;
redshift,SELECT @a1 subject_id @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(subject_id)\nAS\nSELECT\n@a1 subject_id @a2\nFROM\n@c;
redshift,SELECT @a1 analysis_id as @(\w+\b)key @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(@key)\nAS\nSELECT\n@a1 analysis_id as @key @a2\nFROM\n@c;
redshift,SELECT @a1 analysis_id @(\w+\b)key @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(@key)\nAS\nSELECT\n@a1 analysis_id @key @a2\nFROM\n@c;
redshift,SELECT @a1 analysis_id @a2 INTO @b FROM @c;,CREATE TABLE @b\nDISTKEY(analysis_id)\nAS\nSELECT\n@a1 analysis_id @a2\nFROM\n@c;
redshift,SELECT @a INTO @b FROM @c;,CREATE TABLE @b DISTSTYLE ALL\nAS\nSELECT\n@a\nFROM\n@c;
redshift,SELECT @a INTO @b;,CREATE TABLE @b DISTSTYLE ALL\nAS\nSELECT\n@a;
redshift,[ person_id ],[person_id]
redshift,[ subject_id ],[subject_id]
redshift,[ analysis_id ],[analysis_id]
redshift,PRIMARY KEY NONCLUSTERED,PRIMARY KEY
redshift,DATETIME,TIMESTAMP
redshift,SELECT DISTINCT TOP @([0-9]+)rows,SELECT TOP @rows DISTINCT
redshift,BIT,BOOLEAN
redshift,MONEY,"DECIMAL(19, 4)"
redshift,SMALLMONEY,"DECIMAL(10, 4)"
redshift,TINYINT,SMALLINT
redshift,FLOAT(@s),FLOAT
redshift,DATETIME2(@p),TIMESTAMP
redshift,DATETIME2,TIMESTAMP
redshift,DATETIME,TIMESTAMP
redshift,DATETIMEOFFSET(@p),TIMESTAMPTZ
redshift,DATETIMEOFFSET,TIMESTAMPTZ
redshift,SMALLDATETIME,TIMESTAMP
redshift,UNIQUEIDENTIFIER,CHAR(36)
redshift,STDEVP(@a),STDDEV_POP(@a)
redshift,VARP(@a),VAR_POP(@a)
redshift,"DATETIME2FROMPARTS(@year,@month,@day,@hour,@minute,@seconds,0,0)","CAST(TO_CHAR(@year,'0000FM')||'-'||TO_CHAR(@month,'00FM')||'-'||TO_CHAR(@day,'00FM')||' '||TO_CHAR(@hour,'00FM')||':'||TO_CHAR(@minute,'00FM')||':'||TO_CHAR(@seconds,'00FM') as TIMESTAMP)"
redshift,"DATETIME2FROMPARTS(@year,@month,@day,@hour,@minute,@seconds,@fractions,@precision)","CAST(TO_CHAR(@year,'0000FM')||'-'||TO_CHAR(@month,'00FM')||'-'||TO_CHAR(@day,'00FM')||' '||TO_CHAR(@hour,'00FM')||':'||TO_CHAR(@minute,'00FM')||':'||TO_CHAR(@seconds,'00FM')||'.'||TO_CHAR(@fractions,repeat('0', @precision) || 'FM') as TIMESTAMP)"
redshift,"DATETIMEOFFSETFROMPARTS (@year,@month,@day,@hour,@minute,@seconds,0,@h_offset,@m_offset,0 )","CAST(TO_CHAR(@year,'0000FM')||'-'||TO_CHAR(@month,'00FM')||'-'||TO_CHAR(@day,'00FM')||' '||TO_CHAR(@hour,'00FM')||':'||TO_CHAR(@minute,'00FM')||':'||TO_CHAR(@seconds,'00FM')||case when @h_offset >= 0 then '+' else '-' end ||TO_CHAR(ABS(@h_offset),'00FM')||':'||TO_CHAR(ABS(@m_offset),'00FM') as TIMESTAMPTZ)"
redshift,"DATETIMEOFFSETFROMPARTS (@year,@month,@day,@hour,@minute,@seconds,@fractions,@h_offset,@m_offset,@precision )","CAST(TO_CHAR(@year,'0000FM')||'-'||TO_CHAR(@month,'00FM')||'-'||TO_CHAR(@day,'00FM')||' '||TO_CHAR(@hour,'00FM')||':'||TO_CHAR(@minute,'00FM')||':'||TO_CHAR(@seconds,'00FM')||'.'||TO_CHAR(@fractions,repeat('0',@precision) || 'FM')||case when @h_offset >= 0 then '+' else '-' end ||TO_CHAR(ABS(@h_offset),'00FM')||':'||TO_CHAR(ABS(@m_offset),'00FM') as TIMESTAMPTZ)"
redshift,GETUTCDATE(),CURRENT_TIMESTAMP
redshift,"SMALLDATETIMEFROMPARTS(@year,@month,@day,@hour,@minute )","CAST(TO_CHAR(@year,'0000FM')||'-'||TO_CHAR(@month,'00FM')||'-'||TO_CHAR(@day,'00FM')||' '||TO_CHAR(@hour,'00FM')||':'||TO_CHAR(@minute,'00FM') as TIMESTAMP)"
redshift,SYSUTCDATETIME(),CURRENT_TIMESTAMP
redshift,"TODATETIMEOFFSET(@expression,@timezone)","CAST(TO_CHAR(CAST(@expression as TIMESTAMP), 'YYYY-MM-DD HH24:MI:SS.US') ||@timezone as TIMESTAMPTZ)"
redshift,"ATN2(@a,@b)","ATAN2(@a,@b)"
redshift,"CHARINDEX(@expression,@in,@start)","case when CHARINDEX(@expression, SUBSTRING(@in,@start)) > 0 then (CHARINDEX(@expression, SUBSTRING(@in,@start)) +@start - 1) else 0 end"
redshift,QUOTENAME(@a),QUOTE_IDENT(@a)
redshift,"SPACE(@n)","REPEAT(' ',@n)"
redshift,"STUFF(@expression,@start,@length,@replace)","SUBSTRING(@expression, 0,@start)||@replace||SUBSTRING(@expression,@start +@length)"
redshift,"CONCAT(@a,@b,@tail)","CONCAT(@a,CONCAT(@b,@tail))"
redshift,"ISDATE(@s)","REGEXP_INSTR(@s, '^(\\d{4}[/\-]?[01]\\d[/\-]?[0123]\\d)([ T]([0-1][0-9]|[2][0-3]):([0-5][0-9])(:[0-5][0-9](.\\d+)?)?)?$')"
redshift,"ISNUMERIC(@s)","REGEXP_INSTR(@s, '^[\-\+]?(\\d*\\.)?\\d+([Ee][\-\+]?\\d+)?$')"
redshift,"PATINDEX(@pattern,@expression)","REGEXP_INSTR(@expression, case when LEFT(@pattern,1)<>'%' and RIGHT(@pattern,1)='%' then '^' else '' end||TRIM('%' FROM REPLACE(@pattern,'_','.'))||case when LEFT(@pattern,1)='%' and RIGHT(@pattern,1)<>'%' then '$' else '' end)"
redshift,"WITH @cte AS (SELECT @s1 '@literal' @s2)","WITH @cte AS (SELECT @s1 CAST('@literal' as TEXT) @s2)"
redshift,^,#
redshift,"CONVERT(DATE, @a)","CAST(@a as DATE)"
redshift,"CONVERT(TIMESTAMPTZ, @a)","CONVERT(TIMESTAMP WITH TIME ZONE, @a)"
pdw,CREATE INDEX @index_name ON #@table (@variable);,-- PDW does not support non-clustered index on temp tables.
pdw,VARCHAR(MAX),VARCHAR(1000)
pdw,HINT DISTRIBUTE_ON_KEY(@key) @hint WITH @a AS @b SELECT @c INTO @d FROM @e;,HINT DISTRIBUTE_ON_KEY(@key) @hint\nCREATE TABLE @d WITH (DISTRIBUTION = HASH(@key))\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
pdw,HINT DISTRIBUTE_ON_RANDOM @hint WITH @a AS @b SELECT @c INTO @d FROM @e;,HINT DISTRIBUTE_ON_RANDOM @hint\nCREATE TABLE @d WITH (DISTRIBUTION = ROUND_ROBIN)\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
pdw,"WITH @a AS @b SELECT @c1 subject_id, @c2 INTO @d FROM @e;","CREATE TABLE @d WITH (DISTRIBUTION = HASH(subject_id))\nAS\nWITH @a AS @b SELECT\n@c1 subject_id, @c2\nFROM\n@e;"
pdw,"WITH @a AS @b SELECT @c1 person_id, @c2 INTO @d FROM @e;","CREATE TABLE @d WITH (DISTRIBUTION = HASH(person_id))\nAS\nWITH @a AS @b SELECT\n@c1 person_id, @c2\nFROM\n@e;"
pdw,"WITH @a AS @b SELECT @c1 analysis_id, @c2 INTO @d FROM @e;","CREATE TABLE @d WITH (DISTRIBUTION = HASH(analysis_id))\nAS\nWITH @a AS @b SELECT\n@c1 analysis_id, @c2\nFROM\n@e;"
pdw,WITH @a AS @b SELECT @c INTO @d FROM @e;,CREATE TABLE @d WITH (DISTRIBUTION = REPLICATE)\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
pdw,HINT DISTRIBUTE_ON_KEY(@key) @hint SELECT @a INTO @b FROM @c;,HINT DISTRIBUTE_ON_KEY(@key) @hint\nCREATE TABLE @b WITH (DISTRIBUTION = HASH(@key))\nAS\nSELECT\n@a\nFROM\n@c;
pdw,HINT DISTRIBUTE_ON_RANDOM @hint SELECT @a INTO @b FROM @c;,HINT DISTRIBUTE_ON_RANDOM @hint\nCREATE TABLE @b WITH (DISTRIBUTION = ROUND_ROBIN)\nAS\nSELECT\n@a\nFROM\n@c;
pdw,"SELECT @a1 subject_id, @a2 INTO @b FROM @c;","CREATE TABLE @b WITH (DISTRIBUTION = HASH(subject_id))\nAS\nSELECT\n@a1 subject_id, @a2\nFROM\n@c;"
pdw,"SELECT @a1 person_id, @a2 INTO @b FROM @c;","CREATE TABLE @b WITH (DISTRIBUTION = HASH(person_id))\nAS\nSELECT\n@a1 person_id, @a2\nFROM\n@c;"
pdw,"SELECT @a1 analysis_id, @a2 INTO @b FROM @c;","CREATE TABLE @b WITH (DISTRIBUTION = HASH(analysis_id))\nAS\nSELECT\n@a1 analysis_id, @a2\nFROM\n@c;"
pdw,SELECT @a INTO @b FROM @c;,CREATE TABLE @b WITH (DISTRIBUTION = REPLICATE)\nAS\nSELECT\n@a\nFROM\n@c;
pdw,SELECT @a INTO @b;,CREATE TABLE @b WITH (DISTRIBUTION = REPLICATE)\nAS\nSELECT\n@a;
pdw,CREATE TABLE #@a WITH (DISTRIBUTION = @b) AS,"CREATE TABLE #@a WITH (LOCATION = USER_DB, DISTRIBUTION = @b) AS"
pdw,HINT DISTRIBUTE_ON_KEY(@key) @hint CREATE TABLE @table (@definition);,HINT DISTRIBUTE_ON_KEY(@key) @hint\nCREATE TABLE @table (@definition)\nWITH (DISTRIBUTION = HASH(@key));
pdw,HINT DISTRIBUTE_ON_RANDOM @hint CREATE TABLE @table (@definition);,HINT DISTRIBUTE_ON_RANDOM @hint\nCREATE TABLE @table (@definition)\nWITH (DISTRIBUTION = ROUND_ROBIN);
pdw,CREATE TABLE @table (@definition_part1 subject_id @definition_part2);,CREATE TABLE @table (@definition_part1 subject_id @definition_part2)\nWITH (DISTRIBUTION = HASH(subject_id));
pdw,CREATE TABLE @table (@definition_part1 person_id @definition_part2);,CREATE TABLE @table (@definition_part1 person_id @definition_part2)\nWITH (DISTRIBUTION = HASH(person_id));
pdw,CREATE TABLE @table (@definition_part1 analysis_id @definition_part2);,CREATE TABLE @table (@definition_part1 analysis_id @definition_part2)\nWITH (DISTRIBUTION = HASH(analysis_id));
pdw,CREATE TABLE @table (@definition);,CREATE TABLE @table (@definition)\nWITH (DISTRIBUTION = REPLICATE);
pdw,CREATE TABLE #@table (@definition) WITH (DISTRIBUTION = @distribution);,"CREATE TABLE #@table (@definition)\nWITH (LOCATION = USER_DB, DISTRIBUTION = @distribution);"
pdw,[ person_id ],[person_id]
pdw,[ subject_id ],[subject_id]
pdw,[ analysis_id ],[analysis_id]
pdw,TRUNCATE TABLE ,IF XACT_STATE() = 1 COMMIT; TR*NC*T* TABLE
pdw,DROP TABLE ,IF XACT_STATE() = 1 COMMIT; DR*P TABLE
pdw,CREATE TABLE ,IF XACT_STATE() = 1 COMMIT; CR**T* TABLE
pdw,TR*NC*T*,TRUNCATE
pdw,DR*P,DROP
pdw,CR**T*,CREATE
pdw,IF OBJECT_ID(@a) IS NOT NULL IF XACT_STATE() = 1 COMMIT;,IF XACT_STATE() = 1 COMMIT; IF OBJECT_ID(@a) IS NOT NULL
impala,"CHARINDEX(@a,@b)","INSTR(@b,@a)"
impala,COUNT_BIG(@a),COUNT(@a)
impala,"LEFT(@str,@chars)","SUBSTR(@str,1,@chars)"
impala,LEN(@a),LENGTH(@a)
impala,LOG(@expression),LN(@expression)
impala,NEWID(),UUID()
impala,"RIGHT(@str,@chars)","SUBSTR(@str,-@chars)"
impala,"ROUND(@a,@b)","ROUND(CAST(@a AS DOUBLE),@b)"
impala,SQUARE(@a),((@a)*(@a))
impala,STDEV(@a),STDDEV(@a)
impala,VAR(@a),VARIANCE(@a)
impala,"DATEADD(d,@days,CAST(@date AS DATE))","DATE_ADD(@date, @days)"
impala,"DATEADD(dd,@days,CAST(@date AS DATE))","DATE_ADD(@date, @days)"
impala,"DATEADD(day,@days,CAST(@date AS DATE))","DATE_ADD(@date, @days)"
impala,"DATEADD(month,@months,CAST(@date AS DATE))","ADD_MONTHS(@date, @months)"
impala,"DATEADD(mm,@months,CAST(@date AS DATE))","ADD_MONTHS(@date, @months)"
impala,"DATEADD(m,@months,CAST(@date AS DATE))","ADD_MONTHS(@date, @months)"
impala,"DATEADD(year,@years,CAST(@date AS DATE))","ADD_MONTHS(@date, 12 * @years)"
impala,"DATEADD(yyyy,@years,CAST(@date AS DATE))","ADD_MONTHS(@date, 12 * @years)"
impala,"DATEADD(yy,@years,CAST(@date AS DATE))","ADD_MONTHS(@date, 12 * @years)"
impala,"DATEADD(d,@days,@date)","DATE_ADD(CAST(@date AS DATE), @days)"
impala,"DATEADD(dd,@days,@date)","DATE_ADD(CAST(@date AS DATE), @days)"
impala,"DATEADD(day,@days,@date)","DATE_ADD(CAST(@date AS DATE), @days)"
impala,"DATEADD(month,@months,@date)","ADD_MONTHS(CAST(@date AS DATE), @months)"
impala,"DATEADD(mm,@months,@date)","ADD_MONTHS(CAST(@date AS DATE), @months)"
impala,"DATEADD(m,@months,@date)","ADD_MONTHS(CAST(@date AS DATE), @months)"
impala,"DATEADD(year,@years,@date)","ADD_MONTHS(CAST(@date AS DATE), 12 * @years)"
impala,"DATEADD(yyyy,@years,@date)","ADD_MONTHS(CAST(@date AS DATE), 12 * @years)"
impala,"DATEADD(yy,@years,@date)","ADD_MONTHS(CAST(@date AS DATE), 12 * @years)"
impala,"DATEDIFF(d,@start, @end)","DATEDIFF(CAST(@end AS DATE), CAST(@start AS DATE))"
impala,"DATEDIFF(dd,@start, @end)","DATEDIFF(CAST(@end AS DATE), CAST(@start AS DATE))"
impala,"DATEDIFF(day,@start, @end)","DATEDIFF(CAST(@end AS DATE), CAST(@start AS DATE))"
impala,"DATEFROMPARTS(@year,@month,@day)","CAST(CONCAT(CAST(@year AS VARCHAR),'-',CAST(@month AS VARCHAR),'-',CAST(@day AS VARCHAR)) AS TIMESTAMP)"
impala,"eomonth(@date)","days_sub(add_months(trunc(CAST(@date AS TIMESTAMP), 'MM'),1),1)"
impala,DAY(@date),DAY(CAST(@date AS DATE))
impala,GETDATE(),NOW()
impala,MONTH(@date),MONTH(CAST(@date AS DATE))
impala,YEAR(@date),YEAR(CAST(@date AS DATE))
impala,CAST(@a AS DATE),"CASE TYPEOF(@a) WHEN 'TIMESTAMP' THEN CAST(@a AS TIMESTAMP) ELSE TO_UTC_TIMESTAMP(CONCAT_WS('-', SUBSTR(CAST(@a AS STRING), 1, 4), SUBSTR(CAST(@a AS STRING), 5, 2), SUBSTR(CAST(@a AS STRING), 7, 2)), 'UTC') END"
impala,"IF OBJECT_ID('@table', 'U') IS NULL CREATE TABLE @table (@definition);",CREATE TABLE IF NOT EXISTS @table (@definition);
impala,"IF OBJECT_ID('@table', 'U') IS NOT NULL DROP TABLE @table;",DROP TABLE IF EXISTS @table;
impala,(SELECT @a UNION SELECT @b) ORDER BY,SELECT * FROM\n(SELECT @a\nUNION\nSELECT @b)\nAS t1 ORDER BY
impala,WITH @a AS @b SELECT @c INTO @d FROM @e;,CREATE TABLE @d\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
impala,SELECT @a INTO @b FROM @c;,CREATE TABLE @b AS\nSELECT\n@a\nFROM\n@c;
impala,SELECT @a INTO @b;,CREATE TABLE @b AS\nSELECT\n@a;
impala,SELECT DISTINCT @a FROM @b INTERSECT SELECT DISTINCT @a FROM @c;,SELECT t1.@a FROM (SELECT DISTINCT @a FROM @b UNION ALL SELECT DISTINCT @a FROM @c) AS t1 GROUP BY @a HAVING COUNT(*) >= 2;
impala,(SELECT DISTINCT @a FROM @b INTERSECT SELECT DISTINCT @a FROM @c),(SELECT t1.@a FROM (SELECT DISTINCT @a FROM @b UNION ALL SELECT DISTINCT @a FROM @c) AS t1 GROUP BY @a HAVING COUNT(*) >= 2)
impala,DELETE FROM @a WHERE @b;,INSERT OVERWRITE TABLE @a SELECT * FROM @a WHERE NOT(@b);
impala,DELETE FROM @a;,TRUNCATE TABLE @a;
impala,.dbo.,.
impala,##,<hash><hash>
impala,#,%temp_prefix%%session_id%
impala,<hash><hash>,##
impala,.location,.`location`
impala,SELECT TOP @([0-9]+)rows @a;,SELECT @a LIMIT @rows;
impala,(SELECT TOP @([0-9]+)rows @a),(SELECT @a LIMIT @rows)
impala,DATE,TIMESTAMP
impala,DATETIME,TIMESTAMP
impala,BIGINT NOT NULL,BIGINT
impala,BOOLEAN NOT NULL,BOOLEAN
impala,CHAR NOT NULL,CHAR
impala,DECIMAL NOT NULL,DECIMAL
impala,DOUBLE NOT NULL,DOUBLE
impala,FLOAT NOT NULL,FLOAT
impala,INT NOT NULL,INT
impala,REAL NOT NULL,REAL
impala,SMALLINT NOT NULL,SMALLINT
impala,STRING NOT NULL,STRING
impala,TIMESTAMP NOT NULL,TIMESTAMP
impala,TINYINT NOT NULL,TINYINT
impala,VARCHAR(@a) NOT NULL,VARCHAR(@a)
impala,BIGINT NULL,BIGINT
impala,BOOLEAN NULL,BOOLEAN
impala,CHAR NULL,CHAR
impala,DECIMAL NULL,DECIMAL
impala,DOUBLE NULL,DOUBLE
impala,FLOAT NULL,FLOAT
impala,INT NULL,INT
impala,REAL NULL,REAL
impala,SMALLINT NULL,SMALLINT
impala,STRING NULL,STRING
impala,TIMESTAMP NULL,TIMESTAMP
impala,TINYINT NULL,TINYINT
impala,VARCHAR(@a) NULL,VARCHAR(@a)
impala,"CHAR,","CHAR(1),"
impala,"CHAR\n+","CHAR(1)\n"
impala,"CHAR)","CHAR(1))"
impala,"CONSTRAINT @a DEFAULT NOW()",""
impala,stats,_stats
netezza,HINT DISTRIBUTE_ON_KEY(@key)\n@statement;,HINT DISTRIBUTE_ON_KEY(@key)\n@statement\nDISTRUBTE ON (@key);
netezza,HINT DISTRIBUTE_ON_RANDOM\n@statement;,HINT DISTRIBUTE_ON_RANDOM\n@statement\nDISTRUBTE ON RANDOM;
netezza,CREATE TABLE #@table (@definition);,CREATE TEMP TABLE @table (@definition);
netezza,WITH @a AS @b SELECT @c INTO #@d FROM @e;,CREATE TEMP TABLE @d\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
netezza,WITH @a AS @b SELECT @c INTO @d FROM @e;,CREATE TABLE @d\nAS\nWITH @a AS @b SELECT\n@c\nFROM\n@e;
netezza,SELECT @a INTO #@b FROM @c;,CREATE TEMP TABLE @b\nAS\nSELECT\n@a\nFROM\n@c;
netezza,SELECT @a INTO @b FROM @c;,CREATE TABLE @b\nAS\nSELECT\n@a\nFROM\n@c;
netezza,"ROUND(@a,@b)","ROUND(CAST(@a AS NUMERIC),@b)"
netezza,CAST(@a AS DATE),"TO_DATE(@a, 'yyyymmdd')"
netezza,CAST(@a AS INT),CAST(@a AS INTEGER)
netezza,CAST(@a AS VARCHAR),CAST(@a AS VARCHAR(1000))
netezza,"CONVERT(VARCHAR,@date,112)","TO_CHAR(@date, 'YYYYMMDD')"
netezza,"DATEADD(d,@days,@date)",(@date + @days)
netezza,"DATEADD(dd,@days,@date)",(@date + @days)
netezza,"DATEADD(day,@days,@date)",(@date + @days)
netezza,"DATEADD(m,@months,@date)",CAST((@date + @months*INTERVAL'1 month') AS DATE)
netezza,"DATEADD(mm,@months,@date)",CAST((@date + @months*INTERVAL'1 month') AS DATE)
netezza,"DATEADD(month,@months,@date)",CAST((@date + @months*INTERVAL'1 month') AS DATE)
netezza,"DATEADD(yy,@years,@date)",CAST((@date + @years*INTERVAL'1 year') AS DATE)
netezza,"DATEADD(yyyy,@years,@date)",CAST((@date + @years*INTERVAL'1 year') AS DATE)
netezza,"DATEADD(year,@years,@date)",CAST((@date + @years*INTERVAL'1 year') AS DATE)
netezza,"DATEDIFF(d,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
netezza,"DATEDIFF(dd,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
netezza,"DATEDIFF(day,@start, @end)",(CAST(@end AS DATE) - CAST(@start AS DATE))
netezza,GETDATE(),CURRENT_DATE
netezza,+ '@a',|| '@a'
netezza,'@a' +,'@a' ||
netezza,YEAR(@variable),"DATE_PART('YEAR', @variable)"
netezza,MONTH(@variable),"DATE_PART('MONTH', @variable)"
netezza,DAY(@variable),"DATE_PART('DAY', @variable)"
netezza,CAST(@a AS varchar(@b)) +,CAST(@a AS varchar(@b)) ||
netezza,+ CAST(@a AS varchar(@b)),|| CAST(@a AS varchar(@b))
netezza,STDEV(@a),STDDEV(@a)
netezza,LEN(@a),CHAR_LENGTH(@a)
netezza,"LOG(@expression,@base)",(LN(@expression)/LN(@base))
netezza,LOG(@expression),LN(@expression)
netezza,LOG10(@expression),LOG(@expression)
netezza,"ISNULL(@a,@b)","COALESCE(@a,@b)"
netezza,COUNT_BIG(@a),COUNT(@a)
netezza,USE @schema;,SET search_path TO @schema;
netezza,"IF OBJECT_ID('@table', 'U') IS NULL CREATE TABLE @table (@definition);",CREATE TABLE IF NOT EXISTS @table (@definition) DISTRIBUTE ON RANDOM;
netezza,"IF OBJECT_ID('@table', 'U') IS NOT NULL DROP TABLE @table;",DROP TABLE @table IF EXISTS;
netezza,.dbo.,.
netezza,CREATE CLUSTERED INDEX @index_name ON @table (@variable);,-- netezza does not support indexes
netezza,CREATE INDEX @index_name ON @table (@variable);,-- netezza does not support indexes
netezza,PRIMARY KEY NONCLUSTERED,PRIMARY KEY
netezza,VARCHAR(MAX),VARCHAR(1000)
netezza,FLOAT,"FLOAT(6)"
netezza,#,
netezza,"LEFT(@variable,@b)","SUBSTR(@variable, 1, @b)"
netezza,"RIGHT(@variable,@b)","SUBSTR(@variable, LENGTH(@variable)-@b+1, @b)"
netezza,SELECT TOP @([0-9]+)rows @a;,SELECT @a LIMIT @rows;
netezza,(SELECT TOP @([0-9]+)rows @a),(SELECT @a LIMIT @rows)
netezza,"CONCAT(@a, @b, @c)","CONCAT(@a, CONCAT(@b, @c))"
netezza,"CONCAT(@a,@b)","@a || @b"
netezza,"POWER(@a,@b)","POW(@a,@b)"
netezza,EOMONTH(@date),LAST_DAY(@date)
netezza,ROWCOUNT(), ROW_NUMBER()
netezza,"DATEFROMPARTS(@year,@month,@day)","TO_DATE(TO_CHAR(@year,'0000')||'-'||TO_CHAR(@month,'00')||'-'||TO_CHAR(@day,'00'), 'YYYY-MM-DD')"
netezza,"DATETIMEFROMPARTS(@year,@month,@day,@hour,@minute,@second,@ms)","TO_DATE(TO_CHAR(@year,'0000')||'-'||TO_CHAR(@month,'00')||'-'||TO_CHAR(@day,'00')||' '||TO_CHAR(@hour,'00')||':'||TO_CHAR(@minute,'00')||':'||TO_CHAR(@second,'00'), 'YYYY-MM-DD HH24:MI:SS')"
bigquery,"DATEDIFF(d,@start, @end)","DATE_DIFF(cast(@end as date), cast(@start as date), DAY)"
bigquery,"DATEDIFF(dd,@start, @end)","DATE_DIFF(cast(@end as date), cast(@start as date), DAY)"
bigquery,"DATEDIFF(day,@start, @end)","DATE_DIFF(cast(@end as date), cast(@start as date), DAY)"
bigquery,"DATEADD(d,@days,@date)","DATE_ADD(cast(@date as date), interval @days DAY)"
bigquery,"DATEADD(dd,@days,@date)","DATE_ADD(cast(@date as date), interval @days DAY)"
bigquery,"DATEADD(day,@days,@date)","DATE_ADD(cast(@date as date), interval @days DAY)"
bigquery,"DATEADD(m,@months,@date)","DATE_ADD(cast(@date as date), interval @months MONTH)"
bigquery,"DATEADD(mm,@months,@date)","DATE_ADD(cast(@date as date), interval @months MONTH)"
bigquery,"DATEADD(month,@months,@date)","DATE_ADD(cast(@date as date), interval @months MONTH)"
bigquery,"GETDATE()","CURRENT_DATE()"
bigquery,"STDEV(@a)","STDDEV(@a)"
bigquery,"HASHBYTES('MD5',@a)","SHA1(@a)"
bigquery,"LEN(@a)","LENGTH(@a)"
bigquery,"COUNT_BIG(@a)","COUNT(@a)"
bigquery,"CAST(@a as:string)","CAST(@a as string)"
bigquery,"CAST(@a as:integer)","CAST(@a as int64)"
bigquery,"CAST(@a as:float)","CAST(@a as float64)"
bigquery,"IF OBJECT_ID('@table', 'U') IS NOT NULL DROP TABLE @table;",DROP TABLE IF EXISTS @table;
bigquery,CAST(@a AS varchar(@b)),CAST(@a AS STRING)
bigquery,"WITH @a INTO #@b FROM","INTO #@b WITH @a FROM"
bigquery,"SELECT @a INTO #@b FROM","INTO #@b SELECT @a FROM"
bigquery,#,temp.
bigquery,"LEFT(@str,@chars)","SUBSTR(@str,0,@chars)"
bigquery,"RIGHT(@str,@chars)","SUBSTR(@str,-@chars)"
bigquery,"cast(@a as float)","cast(@a as float64)"
bigquery,"cast(@a as bigint)","cast(@a as int64)"
bigquery,"cast(@a as int)","cast(@a as int64)"
bigquery,"cast(@a as varchar)","cast(@a as string)"
bigquery,date(@a),cast(@a as date)
bigquery,"cast(concat(@a) as date)","parse_date('%Y%m%d', concat(@a))"
bigquery,"YEAR(@date)","EXTRACT(YEAR from @date)"
bigquery,"MONTH(@date)","EXTRACT(MONTH from @date)"
bigquery,"DAY(@date)","EXTRACT(DAY from @date)"
bigquery,"union select","union distinct select"
bigquery,SELECT DISTINCT @a FROM @b INTERSECT SELECT DISTINCT @a FROM @c;,SELECT t1.@a FROM (SELECT DISTINCT @a FROM @b UNION ALL SELECT DISTINCT @a FROM @c) AS t1 GROUP BY @a HAVING COUNT(*) >= 2;
bigquery,(SELECT DISTINCT @a FROM @b INTERSECT SELECT DISTINCT @a FROM @c),(SELECT t1.@a FROM (SELECT DISTINCT @a FROM @b UNION ALL SELECT DISTINCT @a FROM @c) AS t1 GROUP BY @a HAVING COUNT(*) >= 2)
bigquery,"ISNULL(@a,@b)","IFNULL(@a,@b)"
bigquery,as \" @a \",as @a
bigquery,"coalesce(@([0-9]+)a, @b)","coalesce(@a, cast(@b as int64))"
bigquery,"coalesce(@a, @([0-9]+)b)","coalesce(cast(@a as int64), @b)"
bigquery,"cast(@a as decimal(@b))","cast(@a as float64)"