1.between …and…查询两者之间的值
例如查某一段工资内数值内容
select * from emp where sal between ## (某数值)and ###(某数值);
2.-- 空值查询
– 查询mgr为空的记录
select * from emp where mgr is null;
查询comm不为空的记录
select * from emp where comm is not null;
3.模糊查询: select 字段1[,字段2,…] from 表名 where 字段 [not] like 通配符;
百分号(%)通配符:匹配0个或多个字符
下划线(_)通配符:匹配一个字符
– 查询姓名以b开头的员工信息
select * from emp where ename like ‘b%’;
注释:文本要以 " "英文状态下双引号括起来。
– 查询姓名中包含b的员工信息
select * from emp where ename like “%b%”;
– 查询姓名中第二个字符为a的员工信息
select * from emp where ename like ‘_a%’;
– 练习:查询员工姓名中不包含a的员工信息
select *from emp where ename not like ‘%a%’;