SQL Function Reference

CAST
Converts a value to the specified data type
MySQL
CAST(value AS type)
value
Value to convert
type
Data type to convert
TypeDescription
DATEConverts a value to DATE. Format: "YYYY-MM-DD"
DATETIMEConverts a value to DATETIME. Format: "YYYY-MM-DD HH:MM:SS"
TIMEConverts a value to TIME. Format: "HH:MM:SS"
DECIMAL[(M[,D])]Converts a value to DECIMAL. It has two optional arguments M and D defining the maximum the number of digits and the number of digits after the decimal point. Default, D is 0, Mequals 10.
CHAR[(N)]Converts a value to CHAR. As optional argument, you can pass the maximum length lines.
SIGNEDConverts a value to BIGINT.
UNSIGNEDConverts a value to unsigned BIGINT.
BINARYConverts a value to BINARY.
YEARConverts a value to year.
Examples
MySQL
SELECT CAST(12005.6 AS DECIMAL)