当前位置:网站首页>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
边栏推荐
- Library management system (Shandong Agricultural University Curriculum Design)
- uboot的作用和功能
- Machine learning perceptron model
- R及RStudio下载安装教程(超详细)
- 中国信通院《数据安全产品与服务图谱》,美创科技实现四大板块全覆盖
- Seal Library - installation and introduction
- How to choose the right kubernetes storage plug-in? (09)
- Bib | graph representation based on heterogeneous information network learning to predict drug disease association
- jsp 和 servlet 有什么区别?
- 入行数字IC验证后会做些什么?
猜你喜欢
Classifier visual interpretation stylex: Google, MIT, etc. have found the key attributes that affect image classification
Which software is good for machine vision?
Executive engine module of high performance data warehouse practice based on Impala
john爆破出现Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
LeetCode 2. Add two numbers
sql解决连续登录问题变形-节假日过滤
Exploration and practice of integration of streaming and wholesale in jd.com
曆史上的今天:支付寶推出條碼支付;分時系統之父誕生;世界上第一支電視廣告...
Serial port controls steering gear rotation
Data security industry series Salon (III) | data security industry standard system construction theme Salon
随机推荐
有赞和腾讯云、阿里云一同摘得“中国企业云科技服务商50强”[通俗易懂]
PCL 最小中值平方法拟合平面
john爆破出現Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
Rock PI Development Notes (II): start with rock PI 4B plus (based on Ruixing micro rk3399) board and make system operation
路由模式:hash和history模式
数据安全产业系列沙龙(三)| 数据安全产业标准体系建设主题沙龙
曆史上的今天:支付寶推出條碼支付;分時系統之父誕生;世界上第一支電視廣告...
Global and Chinese markets for slotting milling machines 2022-2028: Research Report on technology, participants, trends, market size and share
sql解决连续登录问题变形-节假日过滤
Cloud native cicd framework: Tekton
什么是泛型?- 泛型入门篇
电脑管理员权限在哪里可以打开
流批一体在京东的探索与实践
[fluent] dart data type boolean type (boolean type definition | logical operation)
Global and Chinese markets for disposable insulin pumps 2022-2028: Research Report on technology, participants, trends, market size and share
TCP server communication process (important)
Library management system (Shandong Agricultural University Curriculum Design)
LeetCode 5. Longest Palindromic Substring
Global and Chinese markets for airport baggage claim conveyors 2022-2028: technology, participants, trends, market size and share Research Report
&lt;四&gt; H264解码输出yuv文件