Snowflake reserved words support
One of the key features of Snowflake is its support for SQL queries, which enables you to manipulate data using a familiar syntax.
With any SQL-based platform, you cannot use certain reserved words as identifiers in queries. This can cause confusion or errors when working with Snowflake.
Snowflake reserved words
Snowflake has a large number of reserved words that are not available for use as identifiers in SQL queries. Snowflake reserves these words because they have specific meanings in SQL and uses them to parse and execute queries correctly
The complete list of Snowflake reserved words is available in the Snowflake. Some examples include:
- ADD
- ALL
- AND
- AS
- BY
- CREATE
- DELETE
- DESC
- DROP
- EXISTS
- GROUP
- INSERT
- INTO
- JOIN
- LIKE
- NOT
- NULL
- OR
- SELECT
- SET
- TABLE
- UNION
- UPDATE
- VALUES
- WHERE
Handling reserved words in Snowflake
When working with Snowflake, avoid using reserved words as identifiers in SQL queries. If you use a reserved word as an identifier, it can cause errors or unexpected behavior in the query.
To avoid these issues, Data Integration provides a technique for handling reserved words:
Quoting identifiers
One way to handle reserved words in Snowflake is to enclose them in double quotes (""). This tells Snowflake to treat the enclosed text as an identifier, rather than a reserved word.
For example, if you wanted to create a table with the name select, you could enclose the name in double quotes like this:
CREATE TABLE "select" (id INT, name VARCHAR);
In the above SQL statement, the reserved word select appears inside the double quotes. Snowflake treats the select as an identifier rather than a reserved word and performs the operation on the select table.
In case you fail to avoid using reserved words, Data Integration generates an error indicating that the reserved word cannot be used as an identifier.