《mysql 必知必會》學習筆記(三)

來源:互聯網
上載者:User

標籤:

concat 用來拼接串,如 select concat(rtrim(vend_name),‘(‘,rtrim(vend_country),‘)‘) from vendors;

其中 rtrim用於去掉右邊的空格,concat中多個串用 , 串連。

另外,一般會伴隨著用欄位的別名使用,以便在客戶機調用。

 

還可以在選擇的欄位中用算數計算,如 select price*count as total from product;

 

文本處理函數:

rtrim 去除右邊空格

upper 轉大寫

left 返回左邊的字元

length 返回串長度

locate 找出串的子串

lower 轉小寫

ltrim 去左邊空格

right 返回右邊串

soundex 返回串的soundex值

substring 返回子串字元

(soundex 將任何文本串轉換為描述其語音表示的字元模式的演算法,考慮了類似的發音自負和音節似的能對串進行發音比較而不是字母比較)

 

 

可以用distinct和彙總參數一起使用 select avg(distinct type) from product;

《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.