zoukankan      html  css  js  c++  java
  • SQL Server中的between(在某个范围)

    SQL Server中的between(在某个范围)

    2018年08月19日 09:21:36 码仙♥ 

    一、建库和建表

    1. create database scort

    2. use scort

    3. create table emp

    4. (

    5. empno int primary key,

    6. ename nvarchar(10),

    7. sal int

    8. )

    9. insert into emp values (7369,'smith',2800);

    10. insert into emp values (7499,'allen',1500);

    11. insert into emp values (7521,'ward',3500);

    12. insert into emp values (7566,'jones',1300);

    13. insert into emp values (7654,'martin',1600);

    14. insert into emp values (7698,'blake',3000);

    二、between的用法

    
     
    1. --查找sal在1500和3000之间的信息(包括1500和3000)

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

    3. --等价于

    4. select * from emp where sal between 1500 and 3000

    
     
    1. --查找sal小于1500或大于3000之间的信息(不包括1500和3000)

    2. select * from emp where sal < 1500 or sal >3000

    3. --等价于

    4. select * from emp where sal not between 1500 and 3000

    本篇博客来自于郝斌老师视频教程的总结以及笔记的整理,仅供学习交流,切勿用于商业用途,如有侵权,请联系博主删除,博主QQ:194760901 

  • 相关阅读:
    linux常用命令
    Python 父类调用子类方法
    import win32api 安装pip install pypiwin32
    Python 封装DTU-215码流卡 第一天
    git apply -v 提示 Skipped patch 打不上patch的解决办法
    2019/10/29
    12/9/2019
    11/9/2019
    9/7/2019
    人生若有命中注定
  • 原文地址:https://www.cnblogs.com/grj001/p/12225606.html
Copyright © 2011-2022 走看看