In this section: |
Tokens are sequences of characters having special lexical significance. There are three basic SQL token types: keywords, literals, and identifiers. A token can be followed by a delimiter or a separator.
delimiter ::= <alpha-literal> | , | ( | ) | < | > | . | : | =
| * | + | - | / | <> | >= | <=
separator ::= <comment> | <space> | <newline>
comment ::= --[<character>]*<newline>
Keywords are tokens that have a predetermined meaning in the SQL language. For clarity, it is recommended that keywords not be used as identifiers. See SQL Translate Keywords, for a list of SQL keywords.
Literals are used in SQL statements to represent values that can occur in the database. Each type of literal represents a distinct kind of database value.
numeric-literal ::= [{+ | -}]<numeric-tail>
numeric-tail ::= <integer>[.<integer>] | .<integer>
approx-literal ::= <numeric-literal> E[{+ | -}] <integer>
alpha-literal ::= '[<lit-character>]*'
literal ::= <alpha-literal> | <numeric-literal> |
<approx-literal>
integer ::= <digit>[<digit>]*
lit-character ::= <non-quote> | "
Note: A non-quote is any character in the character set of a server other than a single-quote symbol. Two single quotes can be used to represent an embedded quote (see the example below).
'Down by the seaside'
'Ain''t got nobody'
- 6.5
Identifiers are tokens used to name database objects. There are two types of identifiers: long and short. Short identifiers cannot exceed 8 characters in length; long identifiers can contain up to 48 characters. Both are formed according to the following lexical rules:
identifier ::= <normal-identifier> | <delimited-identifier>
normal-identifier ::= <alpha>[<id-character>]*
delimited-identifier ::= "<any printable character string>"
id-character ::= <alpha> | <digit> | _
DEPARTMENT
customer_id
Several terms are used in this document to represent identifiers. The purpose is to make it clear what kind of object is being manipulated by a given language construct. Syntactically, the terms have no particular significance-they all represent identifiers-but semantically, the difference is significant. Note that the names of certain classes of database objects must be short identifiers.
authorization-id ::= <short identifier>
location-id ::= <long identifier>
column-name ::= <long identifier>
table-name ::= <short identifier>
view-name ::= <long identifier>
statement-name ::= <short identifier>
range-variable ::= <long identifier>
procedure-name ::= <identifier>
iWay Software |