Mysql-模糊查询

-- 模糊查询(where name like 要查询的数据)
-- like
-- % 替换任意个
-- _ 替换1个

-- 查询名字中 以“凌”开始的名字
select * from student where name like "凌%";

-- 查询姓名中 有“万”所有的名字
select * from student where name like "%万%";

-- 查询有2个字的名字
select * from student where name like "__";

-- 查询有3个字的名字
select * from student where name like "___";

-- 查询至少有2个字的名字
select * from student where name like "__%";

 

表取自:

Mysql-几张供于学习的表 - 夜黎i - 博客园 (cnblogs.com)

posted on 2023-02-01 13:27  夜黎i  阅读(40)  评论(0)    收藏  举报

导航