What is MySQL Collation, how to use it in practice?

Let's say I want to create a search engine in some strange languages ​​in 4 languages:

English Swedish Hebrew Arabic

How to set mappings in MySQL?

+4
source share
2 answers

Comparison determines how MySQL compares strings.

A list of all character sets and sorts can be found using:

SHOW CHARACTER SET; SHOW COLLATION; 

To change the table setting, use:

 ALTER TABLE `my_table` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci 

http://dev.mysql.com/doc/refman/5.0/en/charset.html

+3
source

Sorting determines:

  • The character set used to store characters (UTF8, ISO8859, etc.).
  • Sort and Submission Rules

If you want to have different languages ​​(where you cannot be sure of the same mapping as you mentioned), you can columns with different sorts.

Of course, you can set up the mapping at the database and table level and even set up the string literal mapping.

If you can find the only sorting that handles all the languages ​​of interest to you, this is best.

+4
source

All Articles