《mysql必知必會》學習_第八章_20180730_歡

來源:互聯網
上載者:User

標籤:ima   where   表示   檢索   from   大小寫   技術分享   image   多個   

 

第八章學習LIKE操作符,百分百(%)萬用字元,底線(_)萬用字元 

P47

select prod_id,prod_name from products where prod_name LIKE ‘jet%‘ ;  #表示檢索prod_name列中的值 以jet開頭的所有詞,%表示後面的字元可以是多個也可以是0個#注意,MySQL的搜尋是可以區分大小寫,如果區分,那Jet和jet不一樣#

 

select prod_id,prod_name from products where prod_name LIKE ‘%anvil%; #表示任何位置含有anvil,都能被檢索出來#

P48

select prod_name from products where prod_name LIKE ‘s%e‘; # 表示檢索第一位是s,最後一位是e的所有詞#

P49 底線(_)萬用字元

select prod_id,prod_name from products where prod_name LIKE ‘_ ton anvil‘; #_只能檢索出單個字元#

 select prod_id,prod_name from products where prod_name LIKE ‘% ton anvil‘; #%能檢索出多個字元#

 

 

 注意:能用其他命令符的盡量不用萬用字元,因為萬用字元執行起來比較慢。

 

《mysql必知必會》學習_第八章_20180730_歡

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.