What CONVERT actually works can be seen by transforming the character string into hexadecimal representation: : CONVERT « String « SQL / MySQL






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)

   
    
    
    
    
    
    
  








Related examples in the same category

1.The CONVERT() function allows you to convert dates in the same way as the CAST() function
2.Use CONVERT to copy data from one column of a table into another and change the character set.