Creating mysql table with explicit default character set, what if I don't?

前端 未结 2 564
轮回少年
轮回少年 2021-02-02 10:43

In mysql 5.x Whats the difference if I do something like this:

CREATE TABLE aTable (
    id                       BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
            


        
2条回答
  •  鱼传尺愫
    2021-02-02 11:07

    The word DEFAULT is optional there - so the two are equivalent, i.e. they set the default character set for the 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 ...
    

    You can confirm this using the SHOW CREATE TABLE command.

提交回复
热议问题