SQL BETWEEN 逆序运算符条件值

SQL BETWEEN Operator conditional value in Reverse Order(SQL BETWEEN 逆序运算符条件值)
本文介绍了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 逆序运算符条件值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)