Special Characters in MySQL Table Name

Quote your ambiguous or "special" table names with a back tick:

INSERT INTO `e!` ...

Or better, don't use special characters in table names to avoid such problems.


According to the docs, you can't:

Identifiers are converted to Unicode internally. They may contain these characters:

  • Permitted characters in unquoted identifiers: ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore) Extended: U+0080 .. U+FFFF

  • Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP), except U+0000: ASCII: U+0001 .. U+007F Extended: U+0080 .. U+FFFF

Source: http://dev.mysql.com/doc/refman/5.5/en/identifiers.html


Try with this:

    CREATE TABLE IF NOT EXISTS `e!` (
`aa` int(11) unsigned NOT NULL auto_increment,
`showName` TEXT NOT NULL default '',
`startDateTime` DATETIME NOT NULL ,
`endDateTime` DATETIME NOT NULL ,
PRIMARY KEY  (`aa`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8

If you have whatever special requirements for the table identifiers, that means there is something wrong with your database architecture and/or with understanding database architecture.

You'd better correct these architectural mistakes instead of enforcing silly identifiers