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