首页 > 代码库 > CAST(x, AS type)

CAST(x, AS type)

CAST(x, AS type) 用于将一个数据类型的值转换为另一个数据类型的值

mysql> SELECT CAST(100 AS CHAR(2));   # 将整数类型100转换为带有两个显示宽度的字符串类型,结果为‘10‘+----------------------+| CAST(100 AS CHAR(2)) |+----------------------+| 10                   |+----------------------+

 

 

 

 

    

CAST(x, AS type)