SQL Identifiers

SQL identifiers are tokens that identify the name of a repository, table, column, or view. There are three types of identifiers: unquoted, quoted, and unicode:

Unquoted Identifiers

Unquoted identifiers must begin with a letter (a-z, and non-Latin characters) or an underscore (_). The following characters must be a letter, underscore, digit (0-9), or a dollar sign ($). Unquoted identifiers are case-insensitive, so mY_tablE_NaMe is equivalent to my_table_name.

📘

Note that repository names cannot be referenced with unquoted identifiers because they all contain a / (e.g., "bob/flights")

Example:

SELECT my_first_column FROM my_repo.my_table

Quoted Identifiers

Quoted identifiers are a sequence of characters enclosed in an opening and closing quotation mark ("). Quoted identifiers can contain any character except the character with value 0. To include a double quotation mark (") in the identifier, use two quotations (""). Quoted identifiers are case-sensitive, so "MyRepo" is not equivalent to "myrepo".

Example:

UPDATE "MyRepo"."MyTable" set "Length (in inches)" = 36

Unicode Identifiers

Unicode identifiers are a special type of quoted identifier that can include unicode escaped characters. Any quoted identifier that contains unicode-escaped characters must begin with the characters U&. Unicode characters within the identifier are escaped with a backslash \ followed by a four-digit hex code (ex: \0041) or a six-digit hex code preceded by a plus sign (\+000041).

Example:

SELECT * FROM U&"P\006Fdc\0061sts"."\+002605 St\0061\0072\0072ed";

where U&"P\006Fdc\0061sts"."\+002605 St\0061\0072\0072ed" encodes `"Podcasts"."★ Starred"


Did this page help you?