In mysql 5.x Whats the difference if I do something like this:
CREATE TABLE aTable (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
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.
There are 4 levels of default settings in MySQL: server, database, table, and column. Using lower level defaults, you can override higher lever defaults.
If you alter a table that has default charset set to something other than what the database has set, the table default will override the db default.