网站建设资讯

NEWS

网站建设资讯

mysql类型转换

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

网页题目:mysql类型转换
文章起源:http://njwzjz.com/article/jjoecs.html