如果要搜尋一個欄位裡面有沒有特定關鍵字
常用的sql語法是
select id from books where title like '%快快樂樂學%';

聽說有幾個替代語法效能會比較好
1. SELECT id from books where instr(title,'快快樂樂學')>0;

2. select id from books where locate ('快快樂樂學',title)>0;

3. SELECT id from books where position('快快樂樂學' IN title);

但是實際測試過,其實差不多
不知道是我的資料不適合還是機器效能也有差...orz

undefined
最新SQL語法範例字典

作者: 朝井淳  
譯者: 陳亦苓, 朱浚賢
出版社:旗標  
出版日期:2017/12/12
語言:繁體中文
定價:580元

arrow
arrow
    文章標籤
    mysql
    全站熱搜

    helloworld 發表在 痞客邦 留言(0) 人氣()