MySql模糊查询 concat()函数

时间:2020-03-19 15:06:35   收藏:0   阅读:211

在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()函数的作用为连接字符串。

 

原文:https://www.cnblogs.com/huqingfeng/p/12524125.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!