SQL Dialects Reference/Data structure definition/Delimited identifiers

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

[edit] Delimited identifiers

A method to somehow escape identifiers (table, column names, etc), so they do not have to obey regular identifier rules, such as not colliding with keywords, having some distinct characters, etc.

Dialect Sample Comment
Standard "identifier" The SQL standard calls these "delimited identifiers". The SQL standard requires that delimited identifiers are case-sensitive, although not all servers enforce this.
DB2 "identifier" Case sensitive per standard and also allows special characters
Firebird "identifier" Case sensitive per standard
Ingres "identifier" Case sensitivity for delimited identifiers is specified when a database is created. For compliance with ANSI/ISO Entry SQL-92, delimited identifiers must be case sensitive.
MSSQL [identifier]
"identifier"[1]
Case sensitivity is set by a per-database option.
MySQL `identifier`
"identifier"[2]
Oracle "identifier" Oracle's delimited identifiers are case-sensitive, and all regular identifiers are usually in upper case.
PostgreSQL "identifier" Case sensitive per standard, or case insensitive without escaping (folded to lowercase not per standard)
SQLite [identifier]
"identifier"
'identifier'
identifier
Bracketed keywords are always understood as identifiers. Double-quoted keywords are understood as identifiers if previously seen as such, but are otherwise interpreted as string literals. Single-quoted keywords are interpreted as string literals where such are allowed, but otherwise as identifiers. Some keywords may be used as identifiers even when not quoted.
Virtuoso "identifier"  
Linter "identifier" Case sensitive per standard

Notes:

  1. If the quoted_identifier option is set on — otherwise, "identifier" would be parsed as a string in single quotes
  2. If running in ANSI mode.