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


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


          網站導航:
           
          主站蜘蛛池模板: 清原| 塔城市| 偏关县| 广平县| 江山市| 新津县| 苍南县| 五大连池市| 海晏县| 池州市| 新沂市| 万山特区| 张家口市| 调兵山市| 青冈县| 高青县| 右玉县| 托克逊县| 离岛区| 九龙县| 金湖县| 外汇| 江源县| 弥勒县| 镇赉县| 武功县| 龙南县| 阿巴嘎旗| 囊谦县| 宝清县| 额敏县| 承德县| 巨野县| 屏山县| 凤阳县| 建阳市| 砀山县| 阳东县| 酒泉市| 临夏县| 马尔康县|