- 语法:
CAST (expr AS type)
- 类型:
BINARY # 二进制字符串 CHAR(n) # 普通字符串 DATE # 日期字符串 DATETIME # 时间日期字符串 DECIMAL(m,n) # 精确浮点数 SIGNED # 整数(有正负) TIME # 时间字符串 UNSIGNED # 整数(正数)
- 示例:
mysql> select cast('25' as signed); +----------------------+ | cast('25' as signed) | +----------------------+ | 25 | +----------------------+