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

边栏推荐
- 曆史上的今天:支付寶推出條碼支付;分時系統之父誕生;世界上第一支電視廣告...
- Hard core! One configuration center for 8 classes!
- PWM控制舵机
- The login box of unity hub becomes too narrow to log in
- Yolov5 practice: teach object detection by hand
- [North Asia data recovery] data recovery case of raid crash caused by hard disk disconnection during data synchronization of hot spare disk of RAID5 disk array
- Unity uses ugui to set a simple multi-level horizontal drop-down menu (no code required)
- 入行数字IC验证后会做些什么?
- Global and Chinese markets for disposable insulin pumps 2022-2028: Research Report on technology, participants, trends, market size and share
- Résumé de l'entrevue de Dachang Daquan
猜你喜欢

Penetration tool - intranet permission maintenance -cobalt strike

linux下配置Mysql授权某个用户远程访问,不受ip限制

Mysql database mysqldump why there is no statement to create a database

流批一体在京东的探索与实践

路由模式:hash和history模式

Mathematical analysis_ Notes_ Chapter 6: Riemann integral of univariate function

Routing mode: hash and history mode

LeetCode 2. Add two numbers

Classifier visual interpretation stylex: Google, MIT, etc. have found the key attributes that affect image classification

La boîte de connexion du hub de l'unit é devient trop étroite pour se connecter
随机推荐
Yolov5 practice: teach object detection by hand
What is the difference between self attention mechanism and fully connected graph convolution network (GCN)?
TCP拥塞控制详解 | 2. 背景
Ranger (I) preliminary perception
Student course selection system (curriculum design of Shandong Agricultural University)
mysql数据库mysqldump为啥没有创建数据库的语句
LeetCode 1. Sum of two numbers
uboot的作用和功能
Résumé de l'entrevue de Dachang Daquan
Which software is good for machine vision?
七一献礼:易鲸捷 “百日会战”完美收官 贵阳银行数据库提前封板
Day 18 of leetcode dynamic planning introduction
sql解决连续登录问题变形-节假日过滤
台积电全球员工薪酬中位数约46万,CEO约899万;苹果上调日本的 iPhone 售价 ;Vim 9.0 发布|极客头条...
Global and Chinese markets for airport baggage claim conveyors 2022-2028: technology, participants, trends, market size and share Research Report
Executive engine module of high performance data warehouse practice based on Impala
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
Mathematical analysis_ Notes_ Chapter 5: univariate differential calculus
Digital IC hand tearing code -- voting device
路由模式:hash和history模式