Redshift | Snowflake |
---|---|
select GETDATE() | select CURRENT_TIMESTAMP() |
select TRUNC(CURRENT_TIMESTAMP()) | select DATE_TRUNC(DAY,CURRENT_TIMESTAMP()) |
select SYSDATE | select TO_TIMESTAMP_NTZ(CONVERT_TIMEZONE('UTC',CURRENT_TIMESTAMP())) |
select DATE(CURRENT_TIMESTAMP()) | select TO_DATE(CURRENT_TIMESTAMP()) |
date_time_utc > GETDATE() - 7 | date_time_utc > dateadd('DAY', -7, TO_TIMESTAMP_NTZ(LOCALTIMESTAMP)) |
select coalesce('a') | select coalesce('a', 'b') --you will get error message if you specify only one argument "SQL compilation error: error line 1 at position 7 not enough arguments for function [COALESCE('a')], expected 2, got 1" |
DISTSTYLE | not used |
DISTKEY | not used |
SORTKEY | not used |
SORTKEY(col) | not used |
ENCODE | not used |
interleaved | not used |
bpchar | char |
character varying | varchar |
'now'::character varying | current_timestamp |
identity(start, 0, ([0-9],[0-9])::text) | identity(start, 1) |
Last active
February 16, 2021 03:13
-
-
Save tamiroze/e9a7e7419d971d04d447650f0f882d11 to your computer and use it in GitHub Desktop.
sql syntax differences between Redshift and Snowflake
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment