Reserved & limited keywords¶
Snowflake SQL reserves all ANSI keywords (with the exception of type keywords such as CHAR, DATE, DECIMAL, etc.), as well as some additional keywords (ASC, DESC, MINUS, etc.) that are reserved by other popular databases. Additionally, Snowflake reserves keywords REGEXP and RLIKE (which function like the ANSI reserved keyword LIKE) and SOME (which is a synonym for the ANSI reserved keyword ANY).
To avoid parsing ambiguities, Snowflake SQL also prohibits the use of keywords such as LEFT, OUTER, JOIN, etc. as table names or aliases in the FROM list, and the use of keywords such as TRUE, FALSE, CASE, etc. as column references in scalar expressions.
The following table provides the list of reserved keywords in Snowflake and keywords that are not strictly reserved, but have usage limitations:
Keyword |
Comment |
---|---|
A |
|
ACCOUNT |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
ALL |
Reserved by ANSI. |
ALTER |
Reserved by ANSI. |
AND |
Reserved by ANSI. |
ANY |
Reserved by ANSI. |
AS |
Reserved by ANSI. |
B |
|
BETWEEN |
Reserved by ANSI. |
BY |
Reserved by ANSI. |
C |
|
CASE |
Cannot be used as column reference in a scalar expression. |
CAST |
Cannot be used as column reference in a scalar expression. |
CHECK |
Reserved by ANSI. |
COLUMN |
Reserved by ANSI. |
CONNECT |
Reserved by ANSI. |
CONNECTION |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
CONSTRAINT |
Cannot be used as a column name in CREATE TABLE DDL. |
CREATE |
Reserved by ANSI. |
CROSS |
Cannot be used as table name or alias in a FROM clause. |
CURRENT |
Reserved by ANSI. |
CURRENT_DATE |
Cannot be used as column name (reserved by ANSI). |
CURRENT_TIME |
Cannot be used as column name (reserved by ANSI). |
CURRENT_TIMESTAMP |
Cannot be used as column name (reserved by ANSI). |
CURRENT_USER |
Cannot be used as column name (reserved by ANSI). |
D |
|
DATABASE |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
DELETE |
Reserved by ANSI. |
DISTINCT |
Reserved by ANSI. |
DROP |
Reserved by ANSI. |
E |
|
ELSE |
Reserved by ANSI. |
EXISTS |
Reserved by ANSI. |
F |
|
FALSE |
Cannot be used as column reference in a scalar expression. |
FOLLOWING |
Reserved by ANSI. |
FOR |
Reserved by ANSI. |
FROM |
Reserved by ANSI. |
FULL |
Cannot be used as table name or alias in a FROM clause. |
G |
|
GRANT |
Reserved by ANSI. |
GROUP |
Reserved by ANSI. |
GSCLUSTER |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
H |
|
HAVING |
Reserved by ANSI. |
I |
|
ILIKE |
Reserved by Snowflake. |
IN |
Reserved by ANSI. |
INCREMENT |
Reserved by Snowflake and others. |
INNER |
Cannot be used as table name or alias in a FROM clause. |
INSERT |
Reserved by ANSI. |
INTERSECT |
Reserved by ANSI. |
INTO |
Reserved by ANSI. |
IS |
Reserved by ANSI. |
ISSUE |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
J |
|
JOIN |
Cannot be used as table name or alias in a FROM clause. |
L |
|
LATERAL |
Cannot be used as table name or alias in a FROM clause. |
LEFT |
Cannot be used as table name or alias in a FROM clause. |
LIKE |
Reserved by ANSI. |
LOCALTIME |
Cannot be used as column name (reserved by ANSI). |
LOCALTIMESTAMP |
Cannot be used as column name (reserved by ANSI). |
M |
|
MINUS |
Reserved by Snowflake and others. |
N |
|
NATURAL |
Cannot be used as table name or alias in a FROM clause. |
NOT |
Reserved by ANSI. |
NULL |
Reserved by ANSI. |
O |
|
OF |
Reserved by ANSI. |
ON |
Reserved by ANSI. |
OR |
Reserved by ANSI. |
ORDER |
Reserved by ANSI. |
ORGANIZATION |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
Q |
|
QUALIFY |
Reserved by Snowflake. |
R |
|
REGEXP |
Reserved by Snowflake. |
REVOKE |
Reserved by ANSI. |
RIGHT |
Cannot be used as table name or alias in a FROM clause. |
RLIKE |
Reserved by Snowflake. |
ROW |
Reserved by ANSI. |
ROWS |
Reserved by ANSI. |
S |
|
SAMPLE |
Reserved by ANSI. |
SCHEMA |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
SELECT |
Reserved by ANSI. |
SET |
Reserved by ANSI. |
SOME |
Reserved by Snowflake. |
START |
Reserved by ANSI. |
T |
|
TABLE |
Reserved by ANSI. |
TABLESAMPLE |
Reserved by ANSI. |
THEN |
Reserved by ANSI. |
TO |
Reserved by ANSI. |
TRIGGER |
Reserved by ANSI. |
TRUE |
Cannot be used as column reference in a scalar expression. |
TRY_CAST |
Cannot be used as column reference in a scalar expression. |
U |
|
UNION |
Reserved by ANSI. |
UNIQUE |
Reserved by ANSI. |
UPDATE |
Reserved by ANSI. |
USING |
Cannot be used as table name or alias in a FROM clause. |
V |
|
VALUES |
Reserved by ANSI. |
VIEW |
Cannot be used as an identifier in a SHOW command (e.g. ‘SHOW … IN <identifier>’). |
W |
|
WHEN |
Cannot be used as column reference in a scalar expression. |
WHENEVER |
Reserved by ANSI. |
WHERE |
Reserved by ANSI. |
WITH |
Reserved by ANSI. |