There are only two cast functions, cast() and convert() . They do the same thing with slightly different syntaxes. Cast functions perform typecasting ”that is, they convert results from one type (for example, signed integer) to another (for example, char). The prototypes are as shown here: cast( expression AS type ) convert( expression, type ) The cast() function is ANSI compliant, and convert() is ODBC compliant. Valid types are BINARY , CHAR , DATE , DATETIME , SIGNED (INTEGER) , and UNSIGNED (INTEGER) . Most casting in MySQL happens automatically when needed; for example, if feeding numbers into a string function, they will automatically be cast as strings. |