模糊查询是针对字符串操作的,类似正则表达式,没有正则表达式强大通配符:_ 、% 、[] 、_ 表示任意的单个字符--查询MyStudent表中任意姓张,名字两个字的姓名
select * from MyStudent where fname like '张_'--查询MyStudent表中任意姓张,名字三个字的姓名
select * from MyStudent where fname like '张__'%表示匹配任意多个任意字符--查询MyStudent表中任意姓张的(第一个为张)的姓名字数不限的姓名
select * from MyStudent where fname like '张%'--查询MyStudent表中姓张的名字两个字的
select * from MyStudent where fname like '张%'andlen(fname)=2[]表示筛选范--查询表中所有姓张第二个为数字第三个为妹的名字
select * from MyStudent where fname like '张[0-9]妹'select * from MyStudent where fname like '张[a-z]妹'select * from MyStudent where fname like '张[0-9a-z]妹'--中间为1个字母和和1个数字,字母大小写可以通过约束设定,不区分大小写select * from MyStudent where fname like '张[!0-9]妹'--中间不为数字select * from MyStudent where fname not like '张[0-9]妹'--不能以张开头妹结尾中间不能是数字同上不一样
--查询出表中包含通配符%的姓名 select * from MyStudent where fname like '%[%]%'--通配符放到[]中就转义了不是通配符了--查询表中包含[的姓名select * from MyStudent where fname like '%/[%' escape '/'--指定通配符为/--查询表中包含通配符[]的姓名select * from MyStudent where fname like '%/[/]%' escape '/'--指定通配符为/
mybatis 查询用户总个数时 报错
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION eesy_mybatis.count does not exist. Check the Function Name Parsing a…
在Mybatis中模糊查询like有两种写法: 第一种为SELECT * FROM user WHERE username LIKE #{aaa} 另一种SELECT * FROM user WHERE username LIKE ‘%${value}%’ LIKE #{aaa}执行的SQL为: 使用的是?占位符:对用的是preparedStatem…
转载自 扫盲,为什么分布式一定要有Redis?
考虑到绝大部分写业务的程序员,在实际开发中使用 Redis 的时候,只会 Set Value 和 Get Value 两个操作,对 Redis 整体缺乏一个认知。所以我斗胆以 Redis 为题材,对 Redis …
默认情况下映射文件中插入数据: <insert id"saveUser" parameterType"com.itheima.domain.User">INSERT INTO user (username,address,sex,birthday) VALUES (#{username},#{address},#{sex},#{birthday})</insert>单元测试 Testp…