Reserved words and schemas
Applies to: Databricks SQL Databricks Runtime
Reserved words are literals used as keywords by the SQL language which should not be used as identifiers to avoid unexpected behavior.
Reserved schema names have special meaning to Databricks.
Databricks does not formally disallow any specific literals from being used as identifiers.
However, to use any of the following list of identifiers as a table alias, you must surround the name with back-ticks (`).
Special words in expressions
The following list of identifiers can be used anywhere, but Databricks treats them preferentially as keywords within expressions in certain contexts:
Indicates a column default.
The SQL boolean
The SQL boolean
Used as a column qualifier to indicate explicit lateral correlation.
Use back-ticks (`
NULL` and `
DEFAULT`) or qualify the column names with a table name or alias.
Databricks uses the
CURRENT_ prefix to refer to some configuration settings or other context variables.
The underbar (
_) prefix is intended for Databricks pseudo columns.
In Databricks Runtime, an existing pseudo column is the _metadata column.
Identifiers with these prefixes are not treated preferentially. However, avoid columns or column aliases using these prefixes to avoid unexpected behavior.
Reserved schema names
Databricks reserves the following list of schema names for current or future use:
Future use to qualify builtin functions.
Future use to qualify temporary views and functions.
Holds the SQL Standard information schema.
Database names starting with
Avoid using these names.
ANSI Reserved words
Databricks does not enforce ANSI reserved words. The following list of SQL2016 keywords is provided for informational purposes only.
ALL, ALTER, AND, ANY, ARRAY, AS, AT, AUTHORIZATION
BETWEEN, BOTH, BY
CASE, CAST, CHECK, COLLATE, COLUMN, COMMIT, CONSTRAINT, CREATE, CROSS, CUBE, CURRENT, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER
DELETE, DESCRIBE, DISTINCT, DROP
ELSE, END, ESCAPE, EXCEPT, EXISTS, EXTERNAL, EXTRACT
FALSE, FETCH, FILTER, FOR, FOREIGN, FROM, FULL, FUNCTION
GLOBAL, GRANT, GROUP, GROUPING
IN, INNER, INSERT, INTERSECT, INTERVAL, INTO, IS
LEADING, LEFT, LIKE, LOCAL
NATURAL, NO, NOT, NULL
OF, ON, ONLY, OR, ORDER, OUT, OUTER, OVERLAPS
PARTITION, POSITION, PRIMARY
RANGE, REFERENCES, REVOKE, RIGHT, ROLLBACK, ROLLUP, ROW, ROWS
SELECT, SESSION_USER, SET, SOME, START
TABLE, TABLESAMPLE, THEN, TIME, TO, TRAILING, TRUE, TRUNCATE
UNION, UNIQUE, UNKNOWN, UPDATE, USER, USING
WHEN, WHERE, WINDOW, WITH
-- Using SQL keywords > CREATE TEMPORARY VIEW where(where) AS (VALUES (1)); > SELECT where from FROM where select; 1 -- Usage of NULL > SELECT NULL, `null`, T.null FROM VALUES(1) AS T(null); NULL 1 1 -- current_date is eclipsed by the column alias T.current_date > SELECT (SELECT current_date), current_date, current_date() FROM VALUES(1) AS T(current_date); 2021-10-23 1 2021-10-23 -- Reserved keyword ANTI cannot be used as table alias > SELECT * FROM VALUES(1) AS ANTI; Error in query: no viable alternative at input 'ANTI' > SELECT * FROM VALUES(1) AS `ANTI`; 1