创建带有显式默认字符集的mysql表,如果我没有?
问题描述:
在mysql 5.x如果我做这样的事情有什么区别:
In mysql 5.x Whats the difference if I do something like this:
CREATE TABLE aTable (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
aNumber bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
:
CREATE TABLE aTable (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
aNumber bigint(20) DEFAULT NULL
) ENGINE=InnoDB CHARACTER SET=utf8;
注意我没有在第一个字符集中指定字符集为默认值。我在mysql文档中找不到任何东西。
Notice I am not specifying the character set as default in the first one. I couldn't find anything in the mysql docs.
答
单词 DEFAULT
请参阅MySQL文档中的 CREATE TABLE 。以下是相关位:
See the MySQL documentation for CREATE TABLE. Here's the relevant bit:
table_option:
ENGINE [=] engine_name
... other options ...
| [DEFAULT] CHARACTER SET [=] charset_name
... more options ...
您可以使用 SHOW CREATE TABLE 命令。