Oracle 5.0 Reference Manual page 772

Table of Contents

Advertisement

• ASCII: U+0001 .. U+007F
• Extended: U+0080 .. U+FFFF
• ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not permitted in
quoted or unquoted identifiers.
• Identifiers may begin with a digit but unless quoted may not consist solely of digits.
• Database, table, and column names cannot end with space characters.
• Database and table names cannot contain "/", "\", ".", or characters that are not permitted in file
names.
The identifier quote character is the backtick ("`"):
mysql>
SELECT * FROM `select` WHERE `select`.id > 100;
If the
[535]
ANSI_QUOTES
quotation marks:
mysql>
CREATE TABLE "test" (col INT);
ERROR 1064: You have an error in your SQL syntax...
mysql>
SET sql_mode='ANSI_QUOTES';
mysql>
CREATE TABLE "test" (col INT);
Query OK, 0 rows affected (0.00 sec)
The
[535]
ANSI_QUOTES
Consequently, when this mode is enabled, string literals must be enclosed within single quotation
marks. They cannot be enclosed within double quotation marks. The server SQL mode is controlled as
described in
Section 5.1.7, "Server SQL
Identifier quote characters can be included within an identifier if you quote the identifier. If the character
to be included within the identifier is the same as that used to quote the identifier itself, then you need
to double the character. The following statement creates a table named
named c"d:
mysql>
CREATE TABLE `a``b` (`c"d` INT);
In the select list of a query, a quoted column alias can be specified using identifier or string quoting
characters:
mysql>
SELECT 1 AS `one`, 2 AS 'two';
+-----+-----+
| one | two |
+-----+-----+
|
1 |
2 |
+-----+-----+
Elsewhere in the statement, quoted references to the alias must use identifier quoting or the reference
is treated as a string literal.
It is recommended that you do not use names that begin with
For example, avoid using
Depending on context, it might be interpreted as the expression
Be careful when using
or ambiguous formats such as those just described.
A user variable cannot be used directly in an SQL statement as an identifier or as part of an identifier.
See
Section 9.4, "User-Defined
Schema Object Names
SQL mode is enabled, it is also permissible to quote identifiers within double
mode causes the server to interpret double-quoted strings as identifiers.
Modes".
as an identifier, because an expression such as
1e
[955]
to produce table names because it can produce names in illegal
MD5()
Variables", for more information and examples of workarounds.
752
that contains a column
a`b
or MeN, where
and
Me
M
is ambiguous.
1e+3
or as the number 1e+3.
1e + 3
are integers.
N

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents