If the first condition is FALSE then the second condition is checked in SQL Server?(如果第一个条件为 FALSE,则在 SQL Server 中检查第二个条件?)
问题描述
在 where
子句中,如果第一个条件为 FALSE,那么在 SQL Server 中检查第二个条件?
In a where
clause, if the first condition is FALSE, then the second condition is checked in SQL Server?
例如
select *
from users
where (condition 1) AND (condition 2)
如果条件 1 为 False,是否会检查条件 2?
If condition 1 is False, will condition 2 be checked?
推荐答案
它是不确定的.您不能依赖评估顺序.
It is non-deterministic. You cannot rely on order of evaluation.
SQL Server 查询优化器负责解析 T-SQL 查询并根据表大小、索引等创建执行计划.因此,针对相同数据库架构的相同 T-SQL 语句可能会根据数据库内容、配置等执行不同的操作.
SQL Server query optimizer is responsible for parsing T-SQL query and creating execution plan based on table sizes, indexes, etc. So same T-SQL statement against same database schema might be executed differently depending on database content, configuration, etc.
查询优化器优先考虑执行速度,并能够并行执行单个 T-SQL 语句.过滤子句的执行最终一个接一个执行的可能性很小.
Query optimizer prioritizes speed of execution and is able to parallelise execution of a single T-SQL statement. It is highly unlikely that execution of filter clauses ends up being executed one after another.
这篇关于如果第一个条件为 FALSE,则在 SQL Server 中检查第二个条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如果第一个条件为 FALSE,则在 SQL Server 中检查第


基础教程推荐
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01