You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**Group by an alias**|`SELECT date_trunc('hour',evt_block_time) as col1, COUNT(*) FROM erc721_ethereum evt_Transfer GROUP BY col1`| Same as PostgreSQL |`GROUP BY date_trunc('hour',evt_block_time)`Or: `GROUP BY 1, 2`|
38
38
|**Explicit date/time casting**|`'2021-08-08 17:00'::timestamp`|`cast('2021-08-08 17:00' as timestamp)`|`cast('2021-08-08 17:00' as timestamp)`<br><br>Or, `timestamp '2021-08-08 17:00'`<br><br>There are [many helper functions for casting to date/time types](https://trino.io/docs/current/functions/datetime.html?highlight=date), such as `date(‘2022-01-01’)`|
39
-
|**Checking if an item exists in an array**|`value = ANY (array)`| array_contains(array, value)` |`contains(array,value)`|
39
+
|**Checking if an item exists in an array**|`value = ANY (array)`|`array_contains(array, value)`|[`contains(array,value)` or `contains_sequence(array, array[values])`](https://trino.io/docs/current/functions/array.html#contains)|
40
40
|**Explode**|`SELECT unnest(array) FROM table`|`SELECT explode(array) FROM table`|`SELECT vals.val FROM table1, unnest(arrayFromTable1) as vals(val)`<br><br>you have to use `unnest` with a `cross join`, as described in this [blog post](https://theleftjoin.com/how-to-explode-arrays-with-presto/). |
41
41
|**Median**|`PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY x)`|`PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY x)`|`approx_percentile(x, 0.5)`|
42
42
|**Using “is True/False”**|`X is true`|`X is true`|`X = true`|
0 commit comments