wayne's space

          Novice's Attitude
          數據加載中……
          MySQL常用函數
          函數                     用法                                                   返回結果
          (操作字符函數)
          concat()          concat(t1,t2,...)                                  由t1,t2拼接而成的新字符串。
          concat_ws()    concat_ws(s,t1,t2,...)                          由t1st2s拼接而成新字符串。
          length()          length(s)                                            字符串s的長度。
          left()              left(s,x)                                              字符串s最左邊的x個字符。
          right()            right(s,y)                                            與上面函數相對應。
          trim()             trim(s)                                                去掉字符串s首尾的空格。
          upper()          upper(s)                                             大寫。
          lower()           lower(s)                                              小寫。
          replace()        replace(s,t1,t2)                                    將字符串s中的t1替換為t2。
          substring()    substring(s,n,m)                                截取s的字串,從第n個開始,取m個字符,n從1開始。

          (操作數字函數)
          abs()            abs(n)                                                n的絕對值。
          ceiling()         ceiling(n)                                            不小于n的整數。
          floor()           floor(n)                                              n取整。
          format()        format(n,m)                                       格式化n,精度為m,每三位用逗號隔開。
          mod()           mod(n,m)                                           n對m取模:n%m。
          pow()           pow(n,m)                                            n的m次方。
          rand()          rand()                                                 從0到1.0的隨機數。
          round()        round(n,m)                                 4舍5入(原文:n rounded to m decimal places)。
          sqrt()          sqrt(n)                                                對n開根。  


          (操作日期函數)
          date()            date(dt)                                      一個日期的值。
          hour()           hour(dt)                                      獲取小時。
          minute()        minute(dt)                                   獲取分鐘數。
          second()        second(dt)                                  獲取秒鐘數。
          dayname()      dayname(dt)                               星期幾。
          dayofmonth()  dayofmonth(dt)                          日期號。
          monthname()  monthname(dt)                          月份名。
          month()          month(dt)                                 月份號。
          year()             year(dt)                                     年份。
          curdate()         curdate()                                   當前日期。
          curtime()         curtime()                                   當前時間。
          now()              now()                                       當前date。
          unix_timestamp()   unix_timestamp(dt)             UNIX時間戳。
          utc_timestamp()    utc_timestamp(dt)               UTC時間戳。

          posted on 2011-12-06 15:18 wayne woo 閱讀(400) 評論(0)  編輯  收藏 所屬分類: Database


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 永宁县| 全州县| 沂南县| 资溪县| 普陀区| 南涧| 石城县| 靖远县| 水城县| 藁城市| 汤原县| 仪陇县| 区。| 堆龙德庆县| 扶余县| 临武县| 台前县| 同德县| 个旧市| 阆中市| 三门峡市| 潜山县| 太原市| 额济纳旗| 佛教| 蒙自县| 启东市| 若羌县| 高安市| 廊坊市| 蓝山县| 繁峙县| 固原市| 浦城县| 广南县| 宁强县| 怀柔区| 襄汾县| 葫芦岛市| 宣城市| 内黄县|