码迷,mamicode.com
首页 > 数据库 > 详细

SQL between查询 范围查询

时间:2015-04-24 00:47:46      阅读:365      评论:0      收藏:0      [点我收藏+]

标签:

--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;

技术分享

SQL between查询 范围查询

标签:

原文地址:http://www.cnblogs.com/xuqiulin/p/4452117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!