MySQL 5.7 Reserved Words

In every MySQL version, there are new reserved keywords. The keywords, such as CREATE, SELECT, UPDATE and DROP, are mainly SQL commands or functions.

MySQL developers usually do not use these keywords as database, table or column names. The complete list of keywords and a way to use them can be found in this help article.

List of Keywords

A complete list of all reserved words in MySQL 5.7 can be found here.


Using Keywords in Tables or Columns

Generally, SQL developers advise against using reserved words. However, if you want (or need) to use a reserved word as a table or column name, you can place the respective identifier in special quotation marks, so-called backticks (` `), in the SQL statements.

Here is an example: You want to use the reserved word UPDATE in an SQL statement.

  • This is the wrong way to use it:
    • SELECT update FROM table
  • The interpreter understands the word update as SQL command UPDATE, although it was written in lower case. The result will be a syntax error message.
  • If you write the word update in quotation marks instead, it will be executed correctly.
  • Here is a correct way to use it:
    • SELECT `update` FROM table;

Migration from MySQL 5.x to MySQL 5.7

With each MySQL version, new reserved words are added. If script errors occur after a migration, check whether a reserved word is used as column or table name. If this is the case, you must use the reserved word using backticks in your SQL statements.