QDB recognizes more than 100 SQL keywords related to command names, operators, sorting directives, and table, column, and query
constraints. You must use special syntax to use keywords as names of program objects.
Description:
The SQL standard specifies a huge number of keywords that you can not use as the names of tables, indexes, columns,
databases, user-defined functions, collations, virtual table modules, or any other named object. The list of keywords is so
long that few people can remember them all. For most SQL code, your safest bet is to never use any English language word as
the name of a user-defined object.
If you have to use a keyword as a name, you need to quote it. There are three ways of quoting keywords:
- 'keyword'
- A keyword in single quotes is interpreted as a literal string if it occurs in a context where a string literal
is allowed. Otherwise, it's understood as an identifier.
- "keyword"
- A keyword in double-quotes is interpreted as an identifier if it matches a known identifier. Otherwise, it's
interpreted as a string literal.
- [keyword]
- A keyword in square brackets is always understood as an identifier. This is not standard SQL—this
quoting mechanism is used by MS Access and SQL Server and is included in QDB for compatibility.
Quoted keywords are awkward to read. To help you avoid them, QDB allows many keywords to be used unquoted as the names of
any of the objects listed above as well as triggers, views, and attached databases. In the list of keywords that follows,
keywords that can be used unquoted as identifiers are shown in italics, while those that must be quoted are shown in bold.
Note:
QDB sometimes adds new keywords when it takes on new features. To prevent your code from being broken by future
enhancements, you should normally quote any identifier that is an English word, even if QDB doesn't require it.
The following keywords are currently recognized by QDB:
Special names
The following words are
not keywords in QDB, but are used as names of system objects.
They can be used as identifiers for a different type of object:
|
- ROWID
- SQLITE_MASTER
- SQLITE_SEQUENCE
|
|