1and1 Help Centre Categories

print article

What is a MySQL Reserved Word?

MySQL has a multitude of functions and identifiers which are designated Reserved Words. Since these reserved words have special meaning or functions within the MySQL language, it is best to avoid using them as table, column or field names if at all possible. The best known are CREATE, SELECT, UPDATE and DROP. These reserved words are used as commands in MySQL for performing database operations. These commands are used to create, change or delete databases and datasets. Reserved words in MySQL are usually uppercase to distinguish them from the rest of the MySQL command in documentation, syntax examples, etc. but are actually case-insensitive. While you may be able to type MySQL reserved words in all lowercase without functionality being compromised, it is best practice to follow the de facto standard.

There is a different list of reserved words for each version of MySQL due to the introduction of new functions. The list of reserved words is backwards compatible. In other words, the terms that were reserved in MySQL 4.0 are still reserved in the current release of MySQL.

Reserved words in MySQL 4.1 and above:

ASENSITIVE
CALL
CONDITION
CONTINUE
CURSOR
DECLARE
DETERMINISTIC
EACH
ELSEIF
EXIT
FETCH
INOUT
INSENSITIVE
ITERATE
LEAVE
LOOP
MODIFIES
OUT
READS
RELEASE
REPEAT
RETURN
SCHEMA
SCHEMAS
SENSITIVE
SPECIFIC
SQL
SQLEXCEPTION
SQLSTATE
SQLWARNING
TRIGGER
UNDO
WHILE

Reserved words in MySQL 5.1 and above:

ACCESSIBLE
LINEAR
MASTER_SSL_VERIFY_SERVER_CERT
RANGE
READ_ONLY
READ_WRITE

Please note:
If you wish to use any of these reserved words in your field names, it is necessary to escape them using quotation marks or include the table name.
Example of the use of the reserved word "RANGE":

Incorrect:

SELECT range FROM tablename;

Correct using quotation marks:

SELECT `range` FROM tablename;

Correct using the table name:

SELECT tablename.range FROM tablename;
For additional information, you may want to reference: