当前位置:网站首页>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

边栏推荐
- Unity uses ugui to set a simple multi-level horizontal drop-down menu (no code required)
- 流批一体在京东的探索与实践
- How to solve the failure of printer driver installation of computer equipment
- LeetCode 5. Longest Palindromic Substring
- 学习周刊-总第60期-2022年第25周
- 月报总结|Moonbeam6月份大事一览
- sql解决连续登录问题变形-节假日过滤
- 学生选课系统(山东农业大学课程设计)
- TCP server communication process (important)
- 基于多元时间序列对高考预测分析案例
猜你喜欢

机器学习-感知机模型

串口控制舵机转动

Where can I open computer administrator permissions

The login box of unity hub becomes too narrow to log in

sim2real环境配置教程

PCL point cloud image transformation

PWM breathing lamp

配置基于接口的ARP表项限制和端口安全(限制用户私自接入傻瓜交换机或非法主机接入)

Yyds dry inventory company stipulates that all interfaces use post requests. Why?

【云原生】简单谈谈海量数据采集组件Flume的理解
随机推荐
Library management system (Shandong Agricultural University Curriculum Design)
曆史上的今天:支付寶推出條碼支付;分時系統之父誕生;世界上第一支電視廣告...
LeetCode 5. Longest Palindromic Substring
Yolov5 practice: teach object detection by hand
Leetcode1380: lucky numbers in matrix
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
Typescript array out of order output
大廠面試總結大全
Bib | graph representation based on heterogeneous information network learning to predict drug disease association
历史上的今天:支付宝推出条码支付;分时系统之父诞生;世界上第一支电视广告...
Today in history: Alipay launched barcode payment; The father of time-sharing system was born; The first TV advertisement in the world
Mysql database mysqldump why there is no statement to create a database
Thinking about absolute truth and relative truth
PCL point cloud image transformation
LeetCode 4. 寻找两个正序数组的中位数(hard)
pwm呼吸灯
Global and Chinese markets for disposable insulin pumps 2022-2028: Research Report on technology, participants, trends, market size and share
Interview summary of large factories
Global and Chinese market of switching valves 2022-2028: Research Report on technology, participants, trends, market size and share
流批一体在京东的探索与实践