mysql 字段包含某個字符的函數


 通過sql查詢語句,查詢某個字段中包含特定字符串:

 

例子:查詢e_book表的types字段包含字符串"3",有下面4種方式

select * from e_book where types like "%3%";
select * from e_book where find_in_set('3', types);
select * from e_book where locate('3', types);
select * from e_book where INSTR(types,'3');

第2、3中方式相對速度較快

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM