SQL between查询 范围查询


--sal为员工工资

select * from emp;

 

 

--查询工资在[1500,3000]范围的员工信息

select * from emp where sal >= 1500 and sal <= 3000;

select * from emp where sal between 1500 and 3000;

--上面两句效果一样

 

 

--查询工资小于1500或者大于3000的员工信息

select * from emp where sal < 1500 or 3000 < sal;

select * from emp where sal not between 1500 and 3000;

--上面两句效果一样

 

--查询工资为3000员工信息

select * from emp where sal = 3000;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM