The CAST() and CONVERT() functions may be used to take a
value of one type and produce a value of another type.

The type can be one of the following values:

 --- BINARY
 --- CHAR
 --- DATE
 --- DATETIME
 --- SIGNED [INTEGER]
 --- TIME
 --- UNSIGNED [INTEGER]

CAST() and CONVERT() are available as of MySQL 4.0.2.
The CHAR conversion type is available as of 4.0.6.
The USING form of CONVERT() is available as of 4.1.0.

CAST() and CONVERT(... USING ...) are standard SQL syntax.
The non-USING form of CONVERT() is ODBC syntax.

CONVERT() with USING is used to convert data between different
character sets.  In MySQL, transcoding names are the same as the
corresponding character set names.  For example, this statement converts
the string 'abc' in the server's default character set to the
corresponding string in the utf8 character set:

SELECT CONVERT('abc' USING utf8);

  

The cast functions are useful when you want to create a column with
a specific type in a CREATE ... SELECT statement:
