zoukankan      html  css  js  c++  java
  • MySQL基础学习之函数

    数学函数

    绝对值      abs()

    圆周率      PI()

    平方根  sqrt()

    模除取余   mod(被除数,除数)

    随机数      rand()

    四舍五入    round(数字)

    次方         pow(5,2)

    e为底的指数函数  exp(数字)

    字符串函数

    字符长度       length(字符)

    字符连接       concat(字符1,字符2)

    带符号的字符连接    concat_ws('-','su','zhou')

    字符插入      insert('suzhou',1,2,'yang')

    字符串大写   upper(字符)

    字符串小写   lower(字符)

    字符串比较   strcmp(字符1,字符2)

    字符串截取   substring(字符,3,4)

    字符串位置    locate(字符1,字符2)

    时间

    年月日        curdate()

    时分秒        curtime()

    详细时间     now()

    获得小写月份   month('2014-5-14')

    获得大写月份   monthname('2014-5-15')

    获得星期        dayname('2014-5-16')

    一周中的某天   dayofweek('2014-5-17')

    一年中的周数    week('2014-5-18')

  • 相关阅读:
    LeetCode【125. 验证回文串】
    LeetCode【122. 买卖股票的最佳时机 II】
    LeetCode【121. 买卖股票的最佳时机】
    LeetCode【119. 杨辉三角 II】
    LeetCode【118. 杨辉三角】
    LeetCode【112. 路径总和】
    PAT1024
    PAT1020
    PAT1018
    PAT1017
  • 原文地址:https://www.cnblogs.com/loveyous/p/3732650.html
Copyright © 2011-2022 走看看