Syntax\n------\n\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nDescription\n-----------\n\nThe CONVERT() and CAST() functions take a value of one type and produce a value of another type.\n\nThe type can be one of the following values:\n\n BINARY\n CHAR\n DATE\n DATETIME\n \\[DECIMAL [(M\\[,D\\])](../../data-types/numeric-data-types/decimal.md)]\n DOUBLE\n FLOAT\n INTEGER\n   Short for SIGNED INTEGER\n SIGNED \\[INTEGER]\n UNSIGNED \\[INTEGER]\n TIME\n* VARCHAR (in Oracle mode)\n\nNote that in MariaDB, INT and INTEGER are the same thing.\n\nBINARY produces a string with the BINARY data type. If the optional length is given, BINARY(N) causes the cast to use no more than N bytes of the argument. Values shorter than the given number in bytes are padded with 0x00 bytes to make them equal the length value.\n\nCHAR(N) causes the cast to use no more than the number of characters given in the argument.\n\nThe main difference between the CAST() and CONVERT() is that CONVERT(expr,type) is ODBC syntax while CAST(expr as type) and CONVERT(... USING ...) are SQL92 syntax.\n\nCONVERT() with USING is used to convert data between different character sets. In MariaDB, transcoding names are the same as the corresponding character set names. For example, this statement converts the string 'abc' in the default character set to the corresponding string in the utf8 character set:\n\n``sql\nSELECT CONVERT('abc' USING utf8);\n``\n\nExamples\n--------\n\nSELECT enum_col FROM tbl_name \nORDER BY CAST(enum_col AS CHAR);\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/convert