SQL常用语句--模糊查询LIKE

like模糊查询,支持%和下划线匹配,%匹配多个字符,_下划线:任意一个字符,示例:

1)查询名字中含有张的学生信息

sql 复制代码
select * from student where sname like '%张%';

2)查询名字以张开头的学生信息

sql 复制代码
select * from student where sname like '张%';

3)查询名字以人结尾的学生信息

sql 复制代码
select * from student where sname like '%人';

4)查询名字中第二个字为心的学生信息

sql 复制代码
select * from student where sname like '_心%';

5)查询名字中第三个字为心的学生信息

sql 复制代码
select * from student where sname like '__心%';
相关推荐
泡沫·1 小时前
5.MariaDB数据库管理
数据库·mariadb
i***51261 小时前
【数据库】MySQL的安装与卸载
数据库·mysql·adb
数白2 小时前
Oracle 数据迁移最佳实践(不使用第三方工具)
数据库·oracle
周杰伦fans2 小时前
C# 中的**享元工厂**模式
开发语言·数据库·c#
空空kkk2 小时前
SpringMVC——拦截器
java·数据库·spring·拦截器
J***51682 小时前
MySql中的事务、MySql事务详解、MySql隔离级别
数据库·mysql·adb
SelectDB3 小时前
Apache Doris 中的 Data Trait:性能提速 2 倍的秘密武器
数据库·后端·apache
i***27953 小时前
Spring boot 3.3.1 官方文档 中文
java·数据库·spring boot
TDengine (老段)3 小时前
TDengine 日期函数 DATE 用户手册
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
q***65693 小时前
PostgreSQL 中进行数据导入和导出
大数据·数据库·postgresql