Mysql where not

 

1. 表格内容:

select * from emp_info;

 

 

 

2. 查询 salary 不大于 4000  的 员工信息

select * from emp_info a where not a.salary > 4000 ;

结果:

 

 

3. 查询  salary 不大于 4000,  且 kpi 为 A 的员工信息

select * from emp_info a where (not a.salary > 4000) and a.kpi = 'A' ;

 

 

 

4. 查询  salary 不大于 4000且 kpi 不为 A  的员工信息

select * from emp_info a where not (a.salary > 4000 and a.kpi = 'A') ;

 

 

5. 查询salary 不在 4000-5000 的员工信息:

select * from emp_info a where a.salary not  between 4000 and 5000;

 

posted @ 2021-07-14 23:09  Avicii_2018  阅读(319)  评论(0)    收藏  举报