Mega Code Archive

 
Categories / MySQL / String
 

What CONVERT actually works can be seen by transforming the character string into hexadecimal representation

mysql> mysql> mysql> SELECT HEX(CONVERT('ABC' USING latin1)); +----------------------------------+ | HEX(CONVERT('ABC' USING latin1)) | +----------------------------------+ | 414243                           | +----------------------------------+ 1 row in set (0.00 sec) mysql> mysql> SELECT HEX(CONVERT('ZZZ' USING utf8)); +--------------------------------+ | HEX(CONVERT('ZZZ' USING utf8)) | +--------------------------------+ | 5A5A5A                         | +--------------------------------+ 1 row in set (0.00 sec)