Вы находитесь на странице: 1из 2

9.

3 Reserved Words

DEFAULT

DELAYED

DELETE

DESC

DESCRIBE

DETERMINISTIC

Certain words such as SELECT, DELETE, or BIGINT are reserved and

DISTINCT

DISTINCTROW

DIV

require special treatment for use as identifiers such as table and

DOUBLE

DROP

DUAL

column names. This may also be true for the names of built-in

EACH

ELSE

ELSEIF

functions.

ENCLOSED

ESCAPED

EXISTS

EXIT

EXPLAIN

FALSE

FETCH

FLOAT

FLOAT4

FLOAT8

FOR

FORCE

FOREIGN

FROM

FULLTEXT

GET

GRANT

GROUP

HAVING

HIGH_PRIORITY

HOUR_MICROSECO
ND

HOUR_MINUTE

HOUR_SECOND

IF

Query OK, 0 rows affected (0.01 sec)

IGNORE

IN

INDEX

Exception: A word that follows a period in a qualified name must be

INFILE

INNER

INOUT

INSENSITIVE

INSERT

INT

INT1

INT2

INT3

mysql> CREATE TABLE mydb.interval (begin INT, end INT);

INT4

INT8

INTEGER

Query OK, 0 rows affected (0.01 sec)

INTERVAL

INTO

IO_AFTER_GTIDS

Names of built-in functions are permitted as identifiers but may

IO_BEFORE_GTIDS

IS

ITERATE

require care to be used as such. For example, COUNT is acceptable as

JOIN

KEY

KEYS

a column name. However, by default, no whitespace is permitted in

KILL

LEADING

LEAVE

function invocations between the function name and the

LEFT

LIKE

LIMIT

following ( character. This requirement enables the parser to

LINEAR

LINES

LOAD

LOCALTIME

LOCALTIMESTAMP LOCK

LONG

LONGBLOB

LONGTEXT

LOOP

LOW_PRIORITY

MASTER_BIND

MASTER_SSL_VERIFY_SERV
ER_CERT

MATCH

MAXVALUE

In addition, _FILENAME is reserved. At some point, you might upgrade

MEDIUMBLOB

MEDIUMINT

MEDIUMTEXT

to a higher version, so it is a good idea to have a look at future

MIDDLEINT

MINUTE_MICROSE
COND
MINUTE_SECOND

reserved words, too. You can find these in the manuals that cover

MOD

MODIFIES

NOT

NO_WRITE_TO_BI
NLOG
NULL

NUMERIC

ON

OPTIMIZE

OPTION

OPTIONALLY

OR

ORDER

OUT

OUTER

if you quote it.

OUTFILE

PARTITION

PRECISION

For a more detailed list of reserved words, including differences

PRIMARY

PROCEDURE

PURGE

between versions, see Reserved Words in MySQL 5.6.

RANGE

READ

READS

Table 9.2 Reserved Words in MySQL 5.6.23

READ_WRITE

REAL

REFERENCES

REGEXP

RELEASE

RENAME

REPEAT

REPLACE

REQUIRE

RESIGNAL

RESTRICT

RETURN

REVOKE

RIGHT

RLIKE

Reserved words are permitted as identifiers if you quote them as


described in Section 9.2, Schema Object Names:
mysql> CREATE TABLE interval (begin INT, end INT);
ERROR 1064 (42000): You have an error in your SQL
syntax ...
near 'interval (begin INT, end INT)'
mysql> CREATE TABLE `interval` (begin INT, end INT);

an identifier, so it need not be quoted even if it is reserved:

distinguish whether the name is used in a function call or in


nonfunction context. For further detail on recognition of function
names, see Section 9.2.4, Function Name Parsing and Resolution.
The words in the following table are explicitly reserved in MySQL 5.6.

higher versions of MySQL. Most of the words in the table are


forbidden by standard SQL as column or table names (for
example, GROUP). A few are reserved because MySQL needs them
and uses a yacc parser. A reserved word can be used as an identifier

NATURAL

ACCESSIBLE

ADD

ALL

ALTER

ANALYZE

AND

AS

ASC

ASENSITIVE

BEFORE

BETWEEN

BIGINT

BINARY

BLOB

BOTH

SCHEMA

SCHEMAS

SECOND_MICROSE
COND

BY

CALL

CASCADE

SELECT

SENSITIVE

SEPARATOR

CASE

CHANGE

CHAR

SET

SHOW

SIGNAL

CHARACTER

CHECK

COLLATE

SMALLINT

SPATIAL

SPECIFIC

COLUMN

CONDITION

CONSTRAINT

SQL

SQLEXCEPTION

SQLSTATE

CONTINUE

CONVERT

CREATE

CROSS

CURRENT_DATE

CURRENT_TIME

SQLWARNING

SQL_CALC_FOUND
SQL_BIG_RESULT _ROWS

CURRENT_TIMESTAMP

CURRENT_USER

CURSOR

SQL_SMALL_RESULT

SSL

STARTING

DATABASE

DATABASES

DAY_HOUR

STRAIGHT_JOIN

TABLE

TERMINATED

DAY_MICROSECOND

DAY_MINUTE

DAY_SECOND

THEN

TINYBLOB

TINYINT

DEC

DECIMAL

DECLARE

TINYTEXT

TO

TRAILING

TRIGGER

TRUE

UNDO

UNION

UNIQUE

UNLOCK

UNSIGNED

UPDATE

USAGE

USE

USING

UTC_DATE

UTC_TIME

UTC_TIMESTAMP

VALUES

VARBINARY

VARCHAR

VARCHARACTER

VARYING

WHEN

WHERE

WHILE

WITH

WRITE

XOR

YEAR_MONTH

ZEROFILL

Table 9.3 New Reserved Words in MySQL 5.6


GET

IO_AFTER_GTIDS

IO_BEFORE_GTIDS

MASTER_BIND

ONE_SHOT

PARTITION

SQL_AFTER_GTIDS

SQL_BEFORE_GTIDS

Вам также может понравиться