Identifierare
Gäller för: Databricks Databricks Runtime 10.2 och senare
En identifierare är en sträng som används för att identifiera ett objekt, till exempel en tabell, vy, schema eller kolumn. Azure Databricks har regelbundna identifierare och avgränsade identifierare, som omges av backticks. Alla identifierare är skiftlägesokänsliga.
Syntax
Vanliga identifierare
{ letter | digit | '_' } [ ... ]
Observera
Om är inställt på true
i Databricks Runtime spark.sql.ansi.enabled
kan du inte använda ett reserverat ANSI SQL-nyckelord som identifierare. Mer information finns i ANSI-efterlevnad.
Avgränsade identifierare
`c [ ... ]`
Parametrar
- letter: Valfri bokstav från A-Z eller a-z.
- digit: Alla siffror från 0 till 9.
- c: Alla tecken från teckenuppsättningen. Använd
`
för att escape-specialtecken (till exempel`.`
).
Exempel
-- This CREATE TABLE fails because of the illegal identifier name a.b
CREATE TABLE test (a.b int);
no viable alternative at input 'CREATE TABLE test (a.'(line 1, pos 20)
-- This CREATE TABLE works
CREATE TABLE test (`a.b` int);
-- This CREATE TABLE fails because the special character ` is not escaped
CREATE TABLE test1 (`a`b` int);
no viable alternative at input 'CREATE TABLE test (`a`b`'(line 1, pos 23)
-- This CREATE TABLE works
CREATE TABLE test (`a``b` int);