SQL BETWEEN Operator conditional value in Reverse Order(SQL BETWEEN 逆序运算符条件值)
问题描述
为什么下面的 SQL 查询会显示结果?
Why the following SQL query show results?
SELECT * FROM Products
WHERE Price BETWEEN 10 AND 20;
但是当我们改变值的顺序时,它不会显示任何结果?
but when we change the order of value it will not show any result?
SELECT * FROM Products
WHERE Price BETWEEN 20 AND 10;
推荐答案
如果 test_expression 的值大于或等于 begin_expression 的值且小于或等于 end_expression 的值,则 BETWEEN 返回 TRUE.如果 test_expression 的值小于 begin_expression 的值或大于 end_expression 的值,则 NOT BETWEEN 返回 TRUE.
BETWEEN returns TRUE if the value of test_expression is greater than or equal to the value of begin_expression and less than or equal to the value of end_expression. NOT BETWEEN returns TRUE if the value of test_expression is less than the value of begin_expression or greater than the value of end_expression.
在您的情况下,您的语句评估为大于等于20且小于等于10
In your case, your statement evaluates to
greater than or equal to 20 AND less than or equal to 10
这篇关于SQL BETWEEN 逆序运算符条件值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL BETWEEN 逆序运算符条件值


基础教程推荐
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 在多列上分布任意行 2021-01-01