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

边栏推荐
- The median salary of TSMC's global employees is about 460000, and the CEO is about 8.99 million; Apple raised the price of iPhone in Japan; VIM 9.0 releases | geek headlines
- 学习周刊-总第60期-2022年第25周
- linux下配置Mysql授权某个用户远程访问,不受ip限制
- Unity Json 编写
- Aujourd'hui dans l'histoire: Alipay lance le paiement par code à barres; La naissance du père du système de partage du temps; La première publicité télévisée au monde...
- What is normal distribution? What is the 28 law?
- Trigger: MySQL implements adding or deleting a piece of data in one table and adding another table at the same time
- 机器学习-感知机模型
- 配置基于接口的ARP表项限制和端口安全(限制用户私自接入傻瓜交换机或非法主机接入)
- LeetCode 3. Longest substring without duplicate characters
猜你喜欢

A week of short video platform 30W exposure, small magic push helps physical businesses turn losses into profits

Lampe respiratoire PWM

Résumé de l'entrevue de Dachang Daquan

Multi task prompt learning: how to train a large language model?

Serial port controls steering gear rotation
![john爆破出现Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])](/img/4c/ddf7f8085257d0eb8766dbec251345.png)
john爆破出现Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])

Leetcode1380: lucky numbers in matrix

数学分析_笔记_第5章:一元微分学

Ranger (I) preliminary perception

Mathematical analysis_ Notes_ Chapter 5: univariate differential calculus
随机推荐
C语言中sprintf()函数的用法
618 reprise en profondeur: la méthode gagnante de la famille Haier Zhi
LeetCode 2. 两数相加
Hard core! One configuration center for 8 classes!
数学分析_笔记_第5章:一元微分学
Trigger: MySQL implements adding or deleting a piece of data in one table and adding another table at the same time
unity Hub 登錄框變得很窄 無法登錄
Global and Chinese markets for airport baggage claim conveyors 2022-2028: technology, participants, trends, market size and share Research Report
Yyds dry inventory company stipulates that all interfaces use post requests. Why?
DGraph: 大规模动态图数据集
TCP拥塞控制详解 | 2. 背景
Win11应用商店无法加载页面怎么办?Win11商店无法加载页面
小鹏P7雨天出事故安全气囊没有弹出 官方回应:撞击力度未达到弹出要求
john爆破出現Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
学习周刊-总第60期-2022年第25周
Unity Json 编写
Recalling the college entrance examination and becoming a programmer, do you regret it?
Seal Library - installation and introduction
忆当年高考|成为程序员的你,后悔了吗?
Serial port controls steering gear rotation