Tutorial by Examples

CREATE TABLE foo ( ... name CHARACTER SET utf8mb4 ... );
Vital to using character sets is to tell the MySQL-server what encoding the client's bytes are. Here is one way: SET NAMES utf8mb4; Each language (PHP, Python, Java, ...) has its own way the it usually preferable to SET NAMES. For example: SET NAMES utf8mb4, together with a column declared CH...
There are dozens of character sets with hundreds of collations. (A given collation belongs to only one character set.) See the output of SHOW COLLATION;. There are usually only 4 CHARACTER SETs that matter: ascii -- basic 7-bit codes. latin1 -- ascii, plus most characters needed for Western Eur...
You can set a character set both per table, as well as per individual field using the CHARACTER SET and CHARSET statements: CREATE TABLE Address ( `AddressID` INTEGER NOT NULL PRIMARY KEY, `Street` VARCHAR(80) CHARACTER SET ASCII, `City` VARCHAR(80), `Country` ...

Page 1 of 1