MySQL 預存程序基本函數

來源:互聯網
上載者:User

標籤:style   io   ar   os   sp   檔案   on   art   bs   

  1. 字串類

    CHARSET(str) //返回字串字元集
    CONCAT (string2 [,... ]) //串連字串
    INSTR (string ,substring ) //返回substring首次在string中出現的位置,不存在返回0
    LCASE (string2 ) //轉換成小寫
    LEFT (string2 ,length ) //從string2中的左邊起取length個字元
    LENGTH (string ) //string長度
    LOAD_FILE (file_name ) //從檔案讀取內容
    LOCATE (substring , string [,start_position ] ) 同INSTR,但可指定開始位置
    LPAD (string2 ,length ,pad ) //重複用pad加在string開頭,直到字串長度為length
    LTRIM (string2 ) //去除前端空格
    REPEAT (string2 ,count ) //重複count次
    REPLACE (str ,search_str ,replace_str ) //在str中用replace_str替換search_str
    RPAD (string2 ,length ,pad) //在str後用pad補充,直到長度為length
    RTRIM (string2 ) //去除後端空格
    STRCMP (string1 ,string2 ) //逐字元比較兩字串大小,
    SUBSTRING (str , position [,length ]) //從str的position開始,取length個字元,
    註:mysql中處理字串時,預設第一個字元下標為1,即參數position必須大於等於1
    TRIM([[BOTH|LEADING|TRAILING] [padding] FROM]string2) //去除指定位置的指定字元
    UCASE (string2 ) //轉換成大寫
    RIGHT(string2,length) //取string2最後length個字元
    SPACE(count) //產生count個空格

  2. 數字類

    CHARSET(str) //返回字串字元集
    CONCAT (string2 [,... ]) //串連字串
    INSTR (string ,substring ) //返回substring首次在string中出現的位置,不存在返回0
    LCASE (string2 ) //轉換成小寫
    LEFT (string2 ,length ) //從string2中的左邊起取length個字元
    LENGTH (string ) //string長度
    LOAD_FILE (file_name ) //從檔案讀取內容
    LOCATE (substring , string [,start_position ] ) 同INSTR,但可指定開始位置
    LPAD (string2 ,length ,pad ) //重複用pad加在string開頭,直到字串長度為length
    LTRIM (string2 ) //去除前端空格
    REPEAT (string2 ,count ) //重複count次
    REPLACE (str ,search_str ,replace_str ) //在str中用replace_str替換search_str
    RPAD (string2 ,length ,pad) //在str後用pad補充,直到長度為length
    RTRIM (string2 ) //去除後端空格
    STRCMP (string1 ,string2 ) //逐字元比較兩字串大小,
    SUBSTRING (str , position [,length ]) //從str的position開始,取length個字元,
    註:mysql中處理字串時,預設第一個字元下標為1,即參數position必須大於等於1
    TRIM([[BOTH|LEADING|TRAILING] [padding] FROM]string2) //去除指定位置的指定字元
    UCASE (string2 ) //轉換成大寫
    RIGHT(string2,length) //取string2最後length個字元
    SPACE(count) //產生count個空格

  3. 日期時間類

    CHARSET(str) //返回字串字元集
    CONCAT (string2 [,... ]) //串連字串
    INSTR (string ,substring ) //返回substring首次在string中出現的位置,不存在返回0
    LCASE (string2 ) //轉換成小寫
    LEFT (string2 ,length ) //從string2中的左邊起取length個字元
    LENGTH (string ) //string長度
    LOAD_FILE (file_name ) //從檔案讀取內容
    LOCATE (substring , string [,start_position ] ) 同INSTR,但可指定開始位置
    LPAD (string2 ,length ,pad ) //重複用pad加在string開頭,直到字串長度為length
    LTRIM (string2 ) //去除前端空格
    REPEAT (string2 ,count ) //重複count次
    REPLACE (str ,search_str ,replace_str ) //在str中用replace_str替換search_str
    RPAD (string2 ,length ,pad) //在str後用pad補充,直到長度為length
    RTRIM (string2 ) //去除後端空格
    STRCMP (string1 ,string2 ) //逐字元比較兩字串大小,
    SUBSTRING (str , position [,length ]) //從str的position開始,取length個字元,
    註:mysql中處理字串時,預設第一個字元下標為1,即參數position必須大於等於1
    TRIM([[BOTH|LEADING|TRAILING] [padding] FROM]string2) //去除指定位置的指定字元
    UCASE (string2 ) //轉換成大寫
    RIGHT(string2,length) //取string2最後length個字元
    SPACE(count) //產生count個空格

MySQL 預存程序基本函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.