当前位置:网站首页>In MySQL and Oracle, the boundary and range of between and precautions when querying the date
In MySQL and Oracle, the boundary and range of between and precautions when querying the date
2022-07-02 16:52:00 【Promise__ shallow】
About Between The operator
The operator BETWEEN … AND Data range between two values will be selected . These values can be numerical 、 Text or date .
grammar
SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2
- 1.
- 2.
- 3.
- 4.
matters needing attention
For appeals SQL Different database pairs BETWEEN…AND Operators are handled differently . There are mainly three situations ,
- Query out "value1" and “value2” Data between , But does not include “value1” and “value2”
- Some databases list items between “value1” and “value2” Between and including “value1” and “value2” The data of ( such as MQL,ORACLE)
- Other databases will list between “value1” and “value2” Data between , Include “value1” , But does not include “value2” .
Oracle and mysql Of between The boundary of the , Range
For the following table test1 Yes 9 Data
Conclusion
between The scope of the : Include boundary values on both sides
eg: id between 3 and 7 Equivalence and id >=3 and id<=7
not between The scope of the : No boundary value
eg:id not between 3 and 7 Equivalence and id < 3 or id>7
Mysql of use between…and… Precautions when querying date
select count(1) from user where regist_date between ‘2017-07-25 00:00:00’ and ‘2017-07-25 24:00:00’;
This article sql The query result of the statement is 0. In fact, the database has a piece of data that meets the query criteria .
The reason for the error :2017-07-25 24:00:00 evening 24 Point is the next day 00 spot 2017-07-26 00:00:00, The database does not recognize 24 Point information ; Change to the next day 00 Click to find the correct result .
hold between…and… Switch to >= <= Can recognize
边栏推荐
- Yyds dry inventory uses thread safe two-way linked list to realize simple LRU cache simulation
- Routing mode: hash and history mode
- TCP拥塞控制详解 | 2. 背景
- Résumé de l'entrevue de Dachang Daquan
- Rock PI Development Notes (II): start with rock PI 4B plus (based on Ruixing micro rk3399) board and make system operation
- 国内比较好的OJ平台[通俗易懂]
- 小鹏P7雨天出事故安全气囊没有弹出 官方回应:撞击力度未达到弹出要求
- System Verilog implements priority arbiter
- PWM控制舵机
- 数据安全产业系列沙龙(三)| 数据安全产业标准体系建设主题沙龙
猜你喜欢
[cloud native] briefly talk about the understanding of flume, a massive data collection component
According to the atlas of data security products and services issued by the China Academy of information technology, meichuang technology has achieved full coverage of four major sectors
机器学习-感知机模型
Data security industry series Salon (III) | data security industry standard system construction theme Salon
Summary | three coordinate systems in machine vision and their relationships
TCP congestion control details | 2 background
Mathematical analysis_ Notes_ Chapter 6: Riemann integral of univariate function
July 1st gift: Yi Jingjie's "hundred day battle" ended perfectly, and the database of Guiyang bank was sealed in advance
小鹏P7雨天出事故安全气囊没有弹出 官方回应:撞击力度未达到弹出要求
DGraph: 大规模动态图数据集
随机推荐
Bib | graph representation based on heterogeneous information network learning to predict drug disease association
Global and Chinese markets for airport baggage claim conveyors 2022-2028: technology, participants, trends, market size and share Research Report
AcWing 300. Task arrangement
PWM breathing lamp
有赞和腾讯云、阿里云一同摘得“中国企业云科技服务商50强”[通俗易懂]
C语言自定义函数的方法
Library management system (Shandong Agricultural University Curriculum Design)
只是巧合?苹果iOS16的神秘技术竟然与中国企业5年前产品一致!
深度学习图像数据自动标注[通俗易懂]
john爆破出現Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
Yyds dry inventory executor package (parameter processing function)
ROW_NUMBER()、RANK()、DENSE_RANK区别
Routing mode: hash and history mode
sql解决连续登录问题变形-节假日过滤
路由模式:hash和history模式
Serial port controls steering gear rotation
How to choose the right kubernetes storage plug-in? (09)
618深度複盤:海爾智家的制勝方法論
Yyds dry goods inventory has not revealed the artifact? Valentine's Day is coming. Please send her a special gift~
渗透工具-内网权限维持-Cobalt strike