create database character set collate code example

Example 1: create database mysql utf8

CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;

Example 2: database collation mysql

The main difference is sorting accuracy (when comparing characters in the 
language) and performance. The only special one is utf8_bin which is for 
comparing characters in binary format.

utf8_general_ci is somewhat faster than utf8_unicode_ci, but less accurate 
(for sorting). The specific language utf8 encoding (such as utf8_swedish_ci) 
contain additional language rules that make them the most accurate to sort for 
those languages. Most of the time I use utf8_unicode_ci (I prefer accuracy to 
small performance improvements), unless I have a good reason to prefer a 
specific language.

You can read more on specific unicode character sets on the MySQL manual - 
http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html

Tags:

Sql Example