mysql 模糊查询 concat()

Posted 小小飞侠

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 模糊查询 concat()相关的知识,希望对你有一定的参考价值。

concat() 函数,是用来连接字符串。

精确查询: select * from user where name=”zhangsan” 
模糊查询; select * from user where name like “%zhang%”

在实际的使用中,条件是作为参数传递进来的。 所以我们使用 concat() 函数

mybatis: 
select * from user where name like concat(“%”, #{name},”%”) 

concat(str1,str2,str3,str4,……….); 连接字符串函数,会生成一个字符串 





以上是关于mysql 模糊查询 concat()的主要内容,如果未能解决你的问题,请参考以下文章

如何用MYSQL模糊查询?

Mysql如何对数据库进行模糊查询

mybatis中的模糊查询,Oracle和MySQL中的concat

MySQL联合查询及模糊查询

mysql精准模糊查询使用CONCAT加占位符(下划线“_”)的使用,直接限定了长度和格式

Oracle模糊查询CONCAT参数个数无效