ANY和ALL时没有行返回

问题描述:

OracleANY和ALL时没有行返回

If a subquery returns zero rows, 
the condition [operator]ANY[subquery] evaluates to FALSE 
the condition [operator]ALL[subquery] evaluates to TRUE 

在其布尔逻辑或数学逻辑是基于它?

没有什么不寻常 - 它只是实现了数学的所有并存运营商,其定义为(通俗地说)

给定一组M和谓词p,然后

All m elem M (p) 
<=> each element of M satisfies the predicate p 
<=> there's no element in M that doesn't satisfy p 

显然,对于空集,这是真的,因为它根本不包含任何元素。

给定一组M和谓词p,则

Any m elem M (p) 
<=> there exists at least one element of M that satisfies the predicate p 
<=> for all elements of M, the inverse predicate !p is false 

显然,这是假为空集,因为它不包含在任何的所有元件,因此不具有至少一个元件满足谓词。它还补充的所有(M)很好地定义,因为

All(p) <=> !Any(!p) 

其中!表示逻辑逆NOT。