Conversion functions

The following table describes the supported conversion functions.

Function Description
BIN Returns the binary representation of a number as a string.
CAST Converts a value to a specified data type.
CONVERT Converts a value from one data type to another or between character sets.
CONVERT_TZ Converts a datetime value from one time zone to another and returns the adjusted datetime value.
FORMAT Formats a number as a string.
FROM_BASE64 Decodes a base64-encoded string and returns the decoded value as a string.
HEX Returns the hexadecimal representation of a number or string.
OCT Returns the octal representation of a number or string.
TO_BASE64 Encodes a string into base64 format and returns the encoded string.
UNHEX Converts a hexadecimal string into its binary (byte) representation and returns the result as a string.

For more information, see the MySQL documentation: Cast Functions and Operators, Date and Time Functions, and String Functions and Operators.