The collation represents the set of rules to compare the characters in a character set. If a column has 'n' entries in a database, when they are sorted by order, the output entirely depends on the collation used. The characters ascending or descending order are decided based on the character set. There could be 'n' possible output results for 'n' different collations. To use different collations in a table, use the syntax:


SELECT * FROM table1 ORDER BY column1 COLLATE latin1_german2_ci;


SELECT column1 COLLATE latin1_german2_ci AS COL FROM table ORDER BY COL;

... etc.

The strings 'ABC'='abc' are based on collation. The collations such as 'hp8_english_ci' ?etc which has 'ci' in them represents they are 'case insensitive'. Collations which end with 'cs' or 'bin' are case sensitive.

Each character set can have one or more collations. But each collation has only one character set. When a table is created without the name of character set and only collation is given, the default character set for the collation is taken.

To change the default character set and collation in database, log onto to phpMyadmin, click on operations and select the database to which collation has to be change. A window which shows the operations that can be done on the database is displayed. The collation can be changed in that window.