Identifiers
Applies to: Databricks SQL
Databricks Runtime
An identifier is a string used to identify an object such as a table, view, schema, or column. Azure Databricks supports non-delimited (regular) identifiers and delimited identifiers, which are enclosed within backticks.
Identifiers are case-insensitive when referenced.
For identifiers persisted with a metastore and data source the permitted characters permitted can be restricted.
See Names for details on the specific usage of identifiers.
Non delimited identifiers
Syntax
{ letter | '_' } [ letter | digit | '_' ] [ ... ]
Parameters
- letter: Any ASCII letter from
A
-Z
ora
-z
. - digit: Any ASCII numeral from
0
to9
.
Note
In Databricks Runtime, if spark.sql.ansi.enabled
and spark.sql.ansi.enforceReservedKeywords
are set to true
, you cannot use an ANSI SQL reserved keyword as a non-delimited identifier. For details, see ANSI Compliance.
Delimited identifiers
Syntax
`c [ ... ]`
Parameters
- c: Any character from the Unicode character set. Use
`
to escape`
itself.
Examples
-- This statement fails because the undelimited identifier uses a non-ASCII letter.
> DESCRIBE SELECT 5 AS Ä;
INVALID_IDENTIFIER
-- You can delimit the identifier to use a non-ASCII letter
> DESCRIBE SELECT 5 AS `Ä`;
Ä
-- An identifier with dash needs to be delimited
> DESCRIBE SELECT 5 AS `a-b`;
a-b
-- An identifier with a space needs to be delimited
> DESCRIBE SELECT 5 AS `a b`;
a b
-- An identifier with a special character needs to be delimited
> DESCRIBE SELECT 5 AS `a@b`;
a@b
-- An identifier with a Chinese character needs to be delimited
> DESCRIBE SELECT 5 AS `a中b`;
a中b
-- An identifier with a backtick needs to be delimited and escaped.
> DESCRIBE SELECT 5 AS `a``b`;
a`b
Related
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για