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 逆序运算符条件值


基础教程推荐
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01