- 我的电脑系统:Windows 10 64位
- SQL Server 软件版本: SQL Server 2014 Express
本篇博客里面使用了
scott
库,如何你现在还没有添加这个库到你的服务器里面,请在查看本篇博客前,访问这篇博文来在你的服务器里面附加scott
库。
between
的用法
--查找工资在1500到3000之间(包括1500和3000)的所有的员工的信息
select * from emp
where sal>=1500 and sal<=300
上面的指令等价于:
select * from emp
where sal between 1500 and 3000
--查找工资在小于1500或大于3000之间的所有的员工的信息
select * from emp
where sal<1500 or sal>3000
上面的指令等价于:
select * from emp
where sal not between 1500 and 3000