Reserved Words in MySQL 5.5

In MySQL, there are (key) words reserved for SQL because they denote SQL commands or functions. Therefore, it is best not to use these words as database, table or column names. The best known are CREATE, SELECT, UPDATE and DROP.

For a complete list of over 200 reserved words, visit mysql.com.

Backticks

In general, SQL developers advise not to use reserved words in the future. If you still want to use one as table or column name, you must put the respective identifier in special quotation marks in SQL statements, so-called backticks (` `).

The following example of the reserved word UPDATE shows you how to use backticks correctly:

  Correct
SELECT update FROM table; SELECT `update` FROM table;

Without the backticks, the SQL interpreter would issue a syntax error message, since "update" - although in lower case - would not be interpreted as the identifier of the "update" column, but as the SQL command UPDATE.

Migrating from MySQL 5.1 to MySQL 5.5

More reserved words are added with each version of MySQL. Unlike MySQL 5.1, the words SIGNAL and RESIGNAL are now also reserved in MySQL 5.5. If script errors occur after a migration, check whether any of these words are used as column or table names. If this is the case, correct the affected SQL statements in your scripts using backticks (see above).