关键词:like
% 替换1个或者多个
_ 替换一个
案例:
1.查询姓名中以"小"开始的名字
select name from students where name like "小%";
2.查询姓名中有2个字的名字
select name from students where name like "__";
3.查询姓名中有至少有2个字的名字
select name from students where name like "__%";
关键词:rlike
案例:
1.查询以章开始的姓名
select name from students where name rlike "^章.*";
关键词:in 表示在一个非连续的范围内
案例:
1.查询 年龄为18,34的姓名
select name from students where age in (18,34); --等价于 select name from students where age=18 or age=34;
关键词:between and 表示在一个连续的范围内
案例:
1.查询年龄在18到34之间的姓名
select name from students where age between 18 and 34;
关键词:null
不区分大小写
案例:
1.查询身高为空的姓名
select name from students where height is NULL;