Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Chinese Characters to Name MySQL Tables

Tags:

mysql

What precautions must be taken to use Chinese characters as MySQL table names?

Thanks in advance,

John

like image 735
John Avatar asked Oct 15 '22 11:10

John


1 Answers

SQL supports delimited identifiers to allow table or column names to contain SQL keywords, whitespace, punctuation, other special characters, or international characters.

In MySQL, use back-quotes (or set the ANSI_QUOTES SQL mode to use standard double-quotes).

Example:

mysql> create table `桌子` (id serial);
mysql> show create table `桌子`\G
--------------
show create table `桌子`
--------------

*************************** 1. row ***************************
       Table: 桌子
Create Table: CREATE TABLE `桌子` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
like image 91
Bill Karwin Avatar answered Oct 19 '22 03:10

Bill Karwin