MySql模糊查詢 concat()函數


在sql語句之中,查詢根據場景要求不同有兩種方式,精准查詢與模糊查詢:

 

精確查詢語法:select * from student where name="zhangsan";

模糊查詢語法:select * from student where name like "%*san%";

 

而在java開發時,往往查詢條件是作為參數傳遞過來的,所以有了concat()函數:

 

select * from student where name like concat("%",#{name},"%");

可以看出concat()函數的作用為連接字符串。

 


免責聲明!

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



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